Bug #686807 “Having str not repr as part of the matcher ...” : Bugs : testtools (original) (raw)

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

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.