← Back to team overview

testtools-dev team mailing list archive

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

 

Sounds about right.

In the code I wrote that prompted this I wanted to support single values
and iterables, as the class name doesn't make it obvious which is wanted.
If this could do something similar to support that, it would be great.

Thanks,

James

-- 
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: New

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