Merge lp:~cjwatson/lazr.restful/fix-py3-pretty-print-helpers into lp:lazr.restful

Proposed by Colin Watson
Status: Merged
Merged at revision: 272
Proposed branch: lp:~cjwatson/lazr.restful/fix-py3-pretty-print-helpers
Merge into: lp:lazr.restful
Diff against target: 11 lines (+1/-0)
1 file modified
src/lazr/restful/testing/webservice.py (+1/-0)
To merge this branch: bzr merge lp:~cjwatson/lazr.restful/fix-py3-pretty-print-helpers
Reviewer Review Type Date Requested Status
Thiago F. Pappacena (community) Approve
Review via email: mp+391421@code.launchpad.net

Commit message

Fix pformat_value to apply more escaping to Unicode values.

Description of the change

Otherwise it wasn't enough like repr() as promised by the docstring: for example, '\n' was rendered as a literal newline.

Noticed by the Launchpad test suite when attempting to upgrade lazr.restful to the pretty-printing changes (https://code.launchpad.net/~cjwatson/lazr.restful/py3-pretty-print-helpers/+merge/390200).

To post a comment you must log in.
Revision history for this message
Thiago F. Pappacena (pappacena) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/lazr/restful/testing/webservice.py'
2--- src/lazr/restful/testing/webservice.py 2020-09-07 16:41:27 +0000
3+++ src/lazr/restful/testing/webservice.py 2020-09-28 09:03:19 +0000
4@@ -184,6 +184,7 @@
5 ambiguity.
6 """
7 if isinstance(value, six.text_type):
8+ value = value.encode('unicode_escape').decode('ASCII')
9 if "'" in value and '"' not in value:
10 return '"%s"' % value
11 else:

Subscribers

People subscribed via source and target branches