Merge lp:~cjwatson/lazr.restful/pformat-value-list into lp:lazr.restful

Proposed by Colin Watson
Status: Merged
Merged at revision: 277
Proposed branch: lp:~cjwatson/lazr.restful/pformat-value-list
Merge into: lp:lazr.restful
Diff against target: 26 lines (+6/-0)
2 files modified
NEWS.rst (+4/-0)
src/lazr/restful/testing/webservice.py (+2/-0)
To merge this branch: bzr merge lp:~cjwatson/lazr.restful/pformat-value-list
Reviewer Review Type Date Requested Status
Cristian Gonzalez (community) Approve
Review via email: mp+396429@code.launchpad.net

Commit message

Make pformat_value iterate into lists.

Description of the change

This causes pprint_entry and pprint_collection to print text string representations in the Python 3 style.

Launchpad will need a small patch when integrating this (https://paste.ubuntu.com/p/Vtr9jG9tMv/).

To post a comment you must log in.
Revision history for this message
Cristian Gonzalez (cristiangsp) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS.rst'
2--- NEWS.rst 2021-01-04 11:24:14 +0000
3+++ NEWS.rst 2021-01-18 11:44:33 +0000
4@@ -11,6 +11,10 @@
5 allowing robust use of binary arguments on both Python 2 and 3
6 (bug 1116954).
7
8+Make ``lazr.restful.testing.webservice.pprint_entry`` and
9+``lazr.restful.testing.webservice.pprint_collection`` recurse into lists in
10+order to print text string representations in the Python 3 style.
11+
12 0.23.0 (2020-09-28)
13 ===================
14
15
16=== modified file 'src/lazr/restful/testing/webservice.py'
17--- src/lazr/restful/testing/webservice.py 2021-01-16 23:14:05 +0000
18+++ src/lazr/restful/testing/webservice.py 2021-01-18 11:44:33 +0000
19@@ -191,6 +191,8 @@
20 return '"%s"' % value
21 else:
22 return "'%s'" % value.replace("'", "\\'")
23+ elif isinstance(value, list):
24+ return '[' + ', '.join(pformat_value(item) for item in value) + ']'
25 else:
26 return repr(value)
27

Subscribers

People subscribed via source and target branches