This doesn't read as well, and is more fragile. The right set of
Comparitors - ContainsAllOf, ContainsInOrder, ContainsNoneOf for
example - makes for expressive tests.
Hmmm. Perhaps this doesn't belong in Mox, though. EasyMock uses
Hamcrest to provide this sort of functionality, so perhaps Mox needs
Spamcrest! There's a project to keep me out of trouble for a while.
In the past, I extended unittest.TestCase for my project and added things like
def assertSetEquals(self, left, right, msg) self.assertEquals(set(self), set(right), msg or ('Iterables %s and %r do not contain different elements' % (left, right))
I guess you could implement the assertions mentioned below using list() constructors and set operations.
> This doesn't read as well, and is more fragile. The right set of > Comparitors - ContainsAllOf, ContainsInOrder, ContainsNoneOf for > example - makes for expressive tests.
> Hmmm. Perhaps this doesn't belong in Mox, though. EasyMock uses > Hamcrest to provide this sort of functionality, so perhaps Mox needs > Spamcrest! There's a project to keep me out of trouble for a while.
You can use Comparators in your assertions, as long as you are careful to keep them on the LHS (you may or may not get some strange behavior otherwise).
> In the past, I extended unittest.TestCase for my project and added > things like
> def assertSetEquals(self, left, right, msg) > self.assertEquals(set(self), set(right), > msg or ('Iterables %s and %r do not contain different elements' % > (left, right))
> I guess you could implement the assertions mentioned below using > list() constructors and set operations.
> HTH > Manuel
> Am 19.08.2008 um 21:38 schrieb Simon Brunning:
>> I'd really like to be able to use Mox's comparitors in assertions, as >> well at in mock setup, so, for instance, I could do something like:
>> This doesn't read as well, and is more fragile. The right set of >> Comparitors - ContainsAllOf, ContainsInOrder, ContainsNoneOf for >> example - makes for expressive tests.
>> Hmmm. Perhaps this doesn't belong in Mox, though. EasyMock uses >> Hamcrest to provide this sort of functionality, so perhaps Mox needs >> Spamcrest! There's a project to keep me out of trouble for a while.
On Aug 19, 10:14 pm, "steve middlekauff" <smidd...@gmail.com> wrote:
> You can use Comparators in your assertions, as long as you are careful
> to keep them on the LHS (you may or may not get some strange behavior
> otherwise).