texttest / capturemock

2 stars 2 forks source link

Python3 string format bug #1

Closed jenskje closed 5 years ago

jenskje commented 5 years ago

There's an issue with strings containing quoted substrings instead of just the text in mock files for python3. This has shown itself in the python3 texttest self tests, so the first step is to see if the capturemock self tests show the bug too.

jenskje commented 5 years ago

Resolved by keeping the old manual string manipulation in python2, and using the output of pprint.pformat in python3. In python2, the output from pformat was a long string with \n characters in. This is hard to read, so there is some capturemock-specific code to handle this, add newlines and so on. In python3, long strings will be formatted like

("line 1\n"
 "line 2\n"
...
 "last line\n")

Since this is human readable and does not require special handling, it was decided to let the formats diverge.