Comment 4 for bug 804127

Revision history for this message
Jonathan Lange (jml) wrote :

Well, yes, I agree we should avoid mangling down if we can.

I'm not clear on which bits of the interface you think are not clear.
  * Mismatch.describe() has a poorly defined return type – is it bytes or is it text?
  * Matcher objects must have a working __str__(), but I have to confess I don't know what that is supposed to return in code that works on both Python 2 & 3.
  * assertThat also calls str() on the matchee, which can be anything.
  * These three "strings" are all whacked together and passed to self.fail(), which is in turn passed to AssertionError.

Things I'm happy to change or clarify:
  * Give Mismatch.describe() a clear return type. Pick one of bytes or text. I think the latter makes sense.
  * I don't really care about Matcher.__str__. Bug 686807 shows that it's not great as is.
  * We can do whatever we want to the matchee to get a human-readable thing out of it.
  * We can raise our own exception. But if we do, it should be a subclass of AssertionError.

Whatever we do, we need to be really conscious of maintaining compatibility with Matchers outside of testtools.