← Back to team overview

testtools-dev team mailing list archive

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

 

** Changed in: testtools
       Status: In Progress => Fix Committed

-- 
You received this bug notification because you are a member of testtools
developers, which is subscribed to testtools.
https://bugs.launchpad.net/bugs/615108

Title:
  Please provide a way to match an iterable of matchees

Status in testtools:
  Fix Committed

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/testtools/+bug/615108/+subscriptions


References