Having __str__ not __repr__ as part of the matcher protocol is awkward
Bug #686807 reported by
Michael Hudson-Doyle
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
testtools |
Triaged
|
Wishlist
|
Unassigned |
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.
repr often/always shows object ids and so forther, that aren't interesting or even desirable for the string representation of a matcher.