← Back to team overview

testtools-dev team mailing list archive

Re: [Merge] lp:~lifeless/testtools/haslength into lp:testtools

 

Review: Approve

Nice, I was searching for the moral equivalent of bzr's assertLength and couldn't find it last week ;)

25	+HasLength
26	+~~~~~~~~~
27	+
28	+Check the length of a collection. For example::
29	+
30	+ self.assertThat([1, 2, 3], HasLength(2))

I can see this assertion will fail but stating so in the text would be
clearer IMHO. The other examples in this file I've looked at are of the
form: "Matches if <...>: <example>"


160	+ HasLength = MatchesPredicate(
161	+ lambda x, y: len(x) == y, 'len({0}) is not {1}')
162	+ self.assertThat([1, 2], HasLength(3))

Same here ?

-- 
https://code.launchpad.net/~lifeless/testtools/haslength/+merge/144578
Your team testtools developers is subscribed to branch lp:testtools.


References