Please provide a way to match an iterable of matchees
Bug #615108 reported by
James Westby
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
testtools |
Fix Released
|
Wishlist
|
Jonathan Lange |
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(
Thanks,
James
Related branches
lp:~jml/testtools/all-match-615108
- Robert Collins: Approve
-
Diff: 124 lines (+69/-1)4 files modifiedNEWS (+6/-1)
doc/for-test-authors.rst (+15/-0)
testtools/matchers.py (+20/-0)
testtools/tests/test_matchers.py (+28/-0)
tags: | added: matchers |
Changed in testtools: | |
importance: | Low → Wishlist |
Changed in testtools: | |
status: | Triaged → In Progress |
assignee: | nobody → Jonathan Lange (jml) |
milestone: | none → next |
Changed in testtools: | |
status: | In Progress → Fix Committed |
Changed in testtools: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Somethinh like IterableOf ?