Merge lp://qastaging/~jml/testtools/any-match into lp://qastaging/~testtools-committers/testtools/trunk

Proposed by Jonathan Lange
Status: Merged
Merged at revision: 294
Proposed branch: lp://qastaging/~jml/testtools/any-match
Merge into: lp://qastaging/~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://qastaging/~jml/testtools/any-match
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+139720@code.qastaging.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(Equals(x)).

Feels a lot like we're dancing around a deeper issue in Python.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

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.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches