← 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

 

repr often/always shows object ids and so forther, that aren't
interesting or even desirable for the string representation of a
matcher.

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

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