← Back to team overview

testtools-dev team mailing list archive

[Bug 615108] Re: Please provide a way to match an iterable of matchees

 

Perhaps Each or EachOf.

** Changed in: testtools
       Status: New => Triaged

** Changed in: testtools
   Importance: Undecided => Low

-- 
Please provide a way to match an iterable of matchees
https://bugs.launchpad.net/bugs/615108
You received this bug notification because you are a member of testtools
developers, which is subscribed to testtools.

Status in testtools: Triaged

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





References