Merge lp:~jml/testtools/any-match into lp:~testtools-committers/testtools/trunk
Proposed by
Jonathan Lange
Status: | Merged |
---|---|
Merged at revision: | 294 |
Proposed branch: | lp:~jml/testtools/any-match |
Merge into: | lp:~testtools-committers/testtools/trunk |
Diff against target: |
99 lines (+60/-0) 3 files modified
NEWS (+7/-0) testtools/matchers/_higherorder.py (+20/-0) testtools/tests/matchers/test_higherorder.py (+33/-0) |
To merge this branch: | bzr merge lp:~jml/testtools/any-match |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij | Approve | ||
Review via email: mp+139720@code.launchpad.net |
Commit message
Add new matcher, AnyMatch
Description of the change
Deep in the yak stack I go.
This adds a new matcher, AnyMatch. It's a lot like AllMatch, but where AllMatch
guarantees that all items in a collection match a given matcher, this checks that
just one of them do.
Contains(x) is equivalent to AnyMatch(
Feels a lot like we're dancing around a deeper issue in Python.
To post a comment you must log in.
Looks good. The name is somewhat confusing considering we also have MatchesAny, but it is consistent with the already existing AllMatch (and MatchesAll).
I agree there's a deeper issue here, but until we put a finger on what it is exactly and what the alternatives are this seems reasonable.