← Back to team overview

testtools-dev team mailing list archive

[Bug 686807] Re: Having __str__ not __repr__ as part of the matcher protocol is awkward

 

I'm tempted to close this, but the question raised probably needs
answering/further analysis. I'm not sure what or where though.

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

Title:
  Having __str__ not __repr__ as part of the matcher protocol is awkward

Status in testtools:
  Incomplete

Bug description:
  For example, this is from MismatchesAll:

    def __str__(self):
        return 'MatchesAll(%s)' % ', '.join(map(str, self.matchers))

Wouldn't this:

    def __repr__(self):
        return 'MatchesAll(%r)' % (self.matchers, )

be much easier?  This even seems more in the spirit of what __repr__ is usually used for than what testtools does now.





References