testtools-dev team mailing list archive
-
testtools-dev team
-
Mailing list archive
-
Message #00765
[Bug 615108] Re: Please provide a way to match an iterable of matchees
** Branch linked: lp:~jml/testtools/all-match-615108
** Changed in: testtools
Status: Triaged => In Progress
** Changed in: testtools
Assignee: (unassigned) => Jonathan Lange (jml)
** Changed in: testtools
Milestone: None => next
--
You received this bug notification because you are a member of testtools
developers, which is subscribed to testtools.
https://bugs.launchpad.net/bugs/615108
Title:
Please provide a way to match an iterable of matchees
Status in testtools:
In Progress
Bug description:
Hi,
I frequently want something similar to MatchesAll, but where it applies one
Matcher to an iterable of matchees, collecting all the mismatches (or perhaps
with an option to just return the first as it is hit.)
Shortly after writing a Matcher I will find that I want to test a list of things to
check that they all match, so having a generalised way of doing that would
be great.
results = [x for x in map(matcher.match, matchees) if x is not None]
if results:
return MismatchesAll(results)
Thanks,
James
To manage notifications about this bug go to:
https://bugs.launchpad.net/testtools/+bug/615108/+subscriptions
References