← Back to team overview

testtools-dev team mailing list archive

Re: [Merge] lp:~jml/testtools/unprintable-assertThat-804127 into lp:testtools

 

I've got a little module with tests, the summary of interesting ones is:

    assertThat(_b("\a7"), Equals(_b("\b1")), verbose=True)
Results in a non-ascii byte string for the assertion on Python 2, worse when the bytes include control characters of various sorts. On Python 3 the bytes type ends up in an escaped form when stringified which is much better. All verbose matching with bytes has this issue.

    assertThat(_b("\a7"), MatchesRegex(_b("\b1")))
    assertThat(_b("\a7"), StartsWith(_b("\b1")))
The reverse problem here on Python 3, the matchers are printed as /b'\xb1'/ and 'b'\xb1'' which is not ideal. Python 2 again ends up with a non-ascii assertion.

    assertThat(_u("\a7"), MatchesRegex(_b("\b1")), verbose=True)
Results in an unprintable MismatchError on Python 2.
-- 
https://code.launchpad.net/~jml/testtools/unprintable-assertThat-804127/+merge/70530
Your team testtools developers is subscribed to branch lp:testtools.


References