Merge ~cjwatson/launchpad:py3-code-doctest-unicode-strings into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: dd96cc63c20f7f3762bfccf3cacfaf627612c70c
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:py3-code-doctest-unicode-strings
Merge into: launchpad:master
Diff against target: 456 lines (+99/-78)
11 files modified
lib/lp/code/doc/branch-notifications.txt (+14/-12)
lib/lp/code/doc/branch.txt (+2/-2)
lib/lp/code/doc/codeimport-event.txt (+17/-17)
lib/lp/code/doc/codeimport-job.txt (+2/-2)
lib/lp/code/doc/codeimport-machine.txt (+6/-6)
lib/lp/code/doc/codeimport.txt (+10/-10)
lib/lp/code/doc/revision.txt (+5/-4)
lib/lp/code/doc/xmlrpc-codeimport-scheduler.txt (+2/-2)
lib/lp/code/stories/branches/xx-source-package-branches-empty.txt (+4/-3)
lib/lp/code/stories/feeds/xx-branch-atom.txt (+22/-12)
lib/lp/code/stories/feeds/xx-revision-atom.txt (+15/-8)
Reviewer Review Type Date Requested Status
Colin Watson Approve
Review via email: mp+396735@code.launchpad.net

Commit message

lp.code: Fix u'...' doctest examples for Python 3

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/code/doc/branch-notifications.txt b/lib/lp/code/doc/branch-notifications.txt
2index 87b21d9..5869074 100644
3--- a/lib/lp/code/doc/branch-notifications.txt
4+++ b/lib/lp/code/doc/branch-notifications.txt
5@@ -532,18 +532,20 @@ must also handle the unicode.
6 >>> len(notifications)
7 1
8 >>> email = notifications.pop()
9- >>> email.get_payload(decode=True).decode('utf-8').splitlines()
10- [u'Whiteboard changed to:',
11- u'',
12- u'A new \ua000 summary',
13- u'',
14- u'--',
15- u'lp://dev/~name12/firefox/new-name',
16- u'http://code.launchpad.test/~name12/firefox/new-name',
17- u'',
18- u'You are subscribed to branch lp://dev/~name12/firefox/new-name.',
19- u'To unsubscribe from this branch go to
20- http://code.launchpad.test/~name12/firefox/new-name/+edit-subscription']
21+ >>> for line in email.get_payload(
22+ ... decode=True).decode('utf-8').splitlines():
23+ ... print(line)
24+ Whiteboard changed to:
25+ <BLANKLINE>
26+ A new ꀀ summary
27+ <BLANKLINE>
28+ --
29+ lp://dev/~name12/firefox/new-name
30+ http://code.launchpad.test/~name12/firefox/new-name
31+ <BLANKLINE>
32+ You are subscribed to branch lp://dev/~name12/firefox/new-name.
33+ To unsubscribe from this branch go to
34+ http://code.launchpad.test/~name12/firefox/new-name/+edit-subscription
35
36
37 == Modifications by users other than the branch owner ==
38diff --git a/lib/lp/code/doc/branch.txt b/lib/lp/code/doc/branch.txt
39index c1142c0..3156008 100644
40--- a/lib/lp/code/doc/branch.txt
41+++ b/lib/lp/code/doc/branch.txt
42@@ -102,8 +102,8 @@ imported or remote, name, and so on.
43 ... branch_type=BranchType.MIRRORED, name='dev',
44 ... registrant=registrant, url=factory.getUniqueURL())
45
46- >>> new_branch.name
47- u'dev'
48+ >>> print(new_branch.name)
49+ dev
50
51 The registrant of the branch is the user that originally registered the
52 branch, whereas the owner is the current owner of the branch.
53diff --git a/lib/lp/code/doc/codeimport-event.txt b/lib/lp/code/doc/codeimport-event.txt
54index cac7df5..92bf3c2 100644
55--- a/lib/lp/code/doc/codeimport-event.txt
56+++ b/lib/lp/code/doc/codeimport-event.txt
57@@ -47,7 +47,7 @@ database ids.
58 ... if k.name == 'CODE_IMPORT':
59 ... print(k.name, '<muted>')
60 ... else:
61- ... print(k.name, repr(v))
62+ ... print(k.name, pretty(v))
63
64 We want to concisely check that calling the CodeImportEventSet factory
65 methods with required arguments set to None raise an AssertionError.
66@@ -120,10 +120,10 @@ retrieved using the items() method.
67 >>> print_items(svn_create_event)
68 CODE_IMPORT <muted>
69 OWNER ...
70- REVIEW_STATUS u'REVIEWED'
71+ REVIEW_STATUS 'REVIEWED'
72 ASSIGNEE None
73 UPDATE_INTERVAL None
74- URL u'svn://svn.example.com/trunk'
75+ URL 'svn://svn.example.com/trunk'
76
77 The database IDs of the CodeImport is also recorded. It is useful to
78 collate events associated with deleted CodeImport objects.
79@@ -144,11 +144,11 @@ Subversion URL.
80 >>> print_items(cvs_create_event)
81 CODE_IMPORT <muted>
82 OWNER ...
83- REVIEW_STATUS u'REVIEWED'
84+ REVIEW_STATUS 'REVIEWED'
85 ASSIGNEE None
86 UPDATE_INTERVAL None
87- CVS_ROOT u':pserver:anonymous@cvs.example.com:/cvsroot'
88- CVS_MODULE u'hello'
89+ CVS_ROOT ':pserver:anonymous@cvs.example.com:/cvsroot'
90+ CVS_MODULE 'hello'
91
92 And for a Git import, the git details are recorded.
93
94@@ -158,10 +158,10 @@ And for a Git import, the git details are recorded.
95 >>> print_items(git_create_event)
96 CODE_IMPORT <muted>
97 OWNER ...
98- REVIEW_STATUS u'REVIEWED'
99+ REVIEW_STATUS 'REVIEWED'
100 ASSIGNEE None
101 UPDATE_INTERVAL None
102- URL u'git://git.example.org/main.git'
103+ URL 'git://git.example.org/main.git'
104
105 MODIFY
106 ------
107@@ -220,11 +220,11 @@ when changes were made without creating a correponding event.
108 >>> print_items(modify_event)
109 CODE_IMPORT <muted>
110 OWNER ...
111- REVIEW_STATUS u'SUSPENDED'
112- OLD_REVIEW_STATUS u'REVIEWED'
113+ REVIEW_STATUS 'SUSPENDED'
114+ OLD_REVIEW_STATUS 'REVIEWED'
115 ASSIGNEE None
116 UPDATE_INTERVAL None
117- URL u'svn://svn.example.com/trunk'
118+ URL 'svn://svn.example.com/trunk'
119
120 If no change of interest is found, no event is created.
121
122@@ -312,7 +312,7 @@ case when a user updates the state of the machine through the web UI.
123 ddaa
124
125 >>> print_items(online_event)
126- MESSAGE u'Fubar was fixed'
127+ MESSAGE 'Fubar was fixed'
128
129
130 OFFLINE
131@@ -337,7 +337,7 @@ ICodeImportSet.newOffline method.
132 bazaar-importer
133
134 >>> print_items(offline_event)
135- OFFLINE_REASON u'QUIESCED'
136+ OFFLINE_REASON 'QUIESCED'
137
138 The offline reason must be a value of the CodeImportMachineOfflineReason
139 enum. Since it is internally stored as a string, we need to manually
140@@ -366,8 +366,8 @@ UI.
141 ddaa
142
143 >>> print_items(offline_event)
144- MESSAGE u'Down for fixing'
145- OFFLINE_REASON u'STOPPED'
146+ MESSAGE 'Down for fixing'
147+ OFFLINE_REASON 'STOPPED'
148
149
150 QUIESCE
151@@ -395,7 +395,7 @@ explaining why quiescing was requested.
152 ddaa
153
154 >>> print_items(quiesce_event)
155- MESSAGE u'Production rollout.'
156+ MESSAGE 'Production rollout.'
157
158
159 START
160@@ -516,6 +516,6 @@ The job id is the only datum stored in the key-value data associated
161 with a RECLAIM event.
162
163 >>> print_items(reclaim_event)
164- RECLAIMED_JOB_ID u'42'
165+ RECLAIMED_JOB_ID '42'
166
167
168diff --git a/lib/lp/code/doc/codeimport-job.txt b/lib/lp/code/doc/codeimport-job.txt
169index c0eeee0..0e83ca1 100644
170--- a/lib/lp/code/doc/codeimport-job.txt
171+++ b/lib/lp/code/doc/codeimport-job.txt
172@@ -255,5 +255,5 @@ field now so that we can check that updateHeartbeat has an effect.
173
174 No code import events are generated by this method.
175
176- >>> new_events.summary()
177- u''
178+ >>> print(new_events.summary())
179+ <BLANKLINE>
180diff --git a/lib/lp/code/doc/codeimport-machine.txt b/lib/lp/code/doc/codeimport-machine.txt
181index e2edb28..685599e 100644
182--- a/lib/lp/code/doc/codeimport-machine.txt
183+++ b/lib/lp/code/doc/codeimport-machine.txt
184@@ -33,8 +33,8 @@ hostname and online state information.
185 >>> verifyObject(ICodeImportMachine, sample_machine)
186 True
187
188- >>> sample_machine.hostname
189- u'bazaar-importer'
190+ >>> print(sample_machine.hostname)
191+ bazaar-importer
192
193 >>> print(sample_machine.state.name)
194 ONLINE
195@@ -149,8 +149,8 @@ heartbeat for some time.
196 OFFLINE frobisher
197
198 >>> [new_event] = new_events
199- >>> dict(new_event.items())[CodeImportEventDataType.OFFLINE_REASON]
200- u'STOPPED'
201+ >>> print(dict(new_event.items())[CodeImportEventDataType.OFFLINE_REASON])
202+ STOPPED
203
204
205 setQuiescing
206@@ -171,8 +171,8 @@ bazaar experts or more likely a LOSA (administrator).
207 QUIESCE frobisher name16
208
209 >>> [new_event] = new_events
210- >>> dict(new_event.items())[CodeImportEventDataType.MESSAGE]
211- u'1.1.42 rollout'
212+ >>> print(dict(new_event.items())[CodeImportEventDataType.MESSAGE])
213+ 1.1.42 rollout
214
215
216 Allowed State Transitions
217diff --git a/lib/lp/code/doc/codeimport.txt b/lib/lp/code/doc/codeimport.txt
218index feea404..a95c0a1 100644
219--- a/lib/lp/code/doc/codeimport.txt
220+++ b/lib/lp/code/doc/codeimport.txt
221@@ -421,10 +421,10 @@ Passing both paramters is combined as "and".
222 You can also retrive an import by id and by branch, which will be used
223 to present the import's details on the page of the branch.
224
225- >>> code_import_set.get(svn_import.id).url
226- u'svn://svn.example.com/trunk'
227- >>> code_import_set.getByBranch(cvs_import.branch).cvs_root
228- u':pserver:anonymous@cvs.example.com:/cvsroot'
229+ >>> print(code_import_set.get(svn_import.id).url)
230+ svn://svn.example.com/trunk
231+ >>> print(code_import_set.getByBranch(cvs_import.branch).cvs_root)
232+ :pserver:anonymous@cvs.example.com:/cvsroot
233
234 When you ask for an id that is not present ICodeImportSet.get() raises
235 lp.app.errors.NotFoundError, rather than some internal database exception.
236@@ -467,8 +467,8 @@ Even though David can access CodeImportObjects, he cannot set attributes
237 on those objects.
238
239 >>> login('david.allouche@canonical.com')
240- >>> svn_import.url
241- u'svn://svn.example.com/trunk'
242+ >>> print(svn_import.url)
243+ svn://svn.example.com/trunk
244 >>> svn_import.url = 'svn://svn.example.com/branch/1.0'
245 Traceback (most recent call last):
246 ...
247@@ -479,14 +479,14 @@ method. If any change were made, this method creates and returns a
248 CodeImportEvent describing them. The CodeImportEvent records the user
249 that made the change, so we need to pass the user as an argument.
250
251- >>> svn_import.url
252- u'svn://svn.example.com/trunk'
253+ >>> print(svn_import.url)
254+ svn://svn.example.com/trunk
255 >>> data = {'url': 'svn://svn.example.com/branch/1.0'}
256 >>> modify_event = svn_import.updateFromData(data, nopriv)
257 >>> modify_event.event_type.name
258 'MODIFY'
259- >>> svn_import.url
260- u'svn://svn.example.com/branch/1.0'
261+ >>> print(svn_import.url)
262+ svn://svn.example.com/branch/1.0
263 >>> svn_events = event_set.getEventsForCodeImport(svn_import)
264 >>> [event.event_type.name for event in svn_events]
265 ['CREATE', 'MODIFY']
266diff --git a/lib/lp/code/doc/revision.txt b/lib/lp/code/doc/revision.txt
267index 2b0dae9..46f0219 100644
268--- a/lib/lp/code/doc/revision.txt
269+++ b/lib/lp/code/doc/revision.txt
270@@ -35,8 +35,8 @@ we trust it, there's really no simple way to map that reliably to persons.
271
272 >>> from lp.code.model.revision import RevisionAuthor
273 >>> author = RevisionAuthor(name='ddaa@localhost')
274- >>> author.name
275- u'ddaa@localhost'
276+ >>> print(author.name)
277+ ddaa@localhost
278
279 The log-body of a revision is the commit message of that revision.
280
281@@ -234,5 +234,6 @@ as needed.
282 ... print(parent_id)
283 rev-1
284 rev-2
285- >>> print(revision.getProperties())
286- {u'key': u'value'}
287+ >>> for key, value in sorted(revision.getProperties().items()):
288+ ... print('%s: %s' % (key, value))
289+ key: value
290diff --git a/lib/lp/code/doc/xmlrpc-codeimport-scheduler.txt b/lib/lp/code/doc/xmlrpc-codeimport-scheduler.txt
291index 0b6404d..117e87a 100644
292--- a/lib/lp/code/doc/xmlrpc-codeimport-scheduler.txt
293+++ b/lib/lp/code/doc/xmlrpc-codeimport-scheduler.txt
294@@ -62,7 +62,7 @@ previously unseen hostnames.
295 0
296 >>> new_machine = getUtility(ICodeImportMachineSet).getByHostname(
297 ... 'doesnt-exist-yet')
298- >>> new_machine.hostname
299- u'doesnt-exist-yet'
300+ >>> print(new_machine.hostname)
301+ doesnt-exist-yet
302 >>> new_machine.state.name
303 'ONLINE'
304diff --git a/lib/lp/code/stories/branches/xx-source-package-branches-empty.txt b/lib/lp/code/stories/branches/xx-source-package-branches-empty.txt
305index b680e96..b38fe32 100644
306--- a/lib/lp/code/stories/branches/xx-source-package-branches-empty.txt
307+++ b/lib/lp/code/stories/branches/xx-source-package-branches-empty.txt
308@@ -40,9 +40,10 @@ Since there are no branches, there is no branch listing table:
309 >>> print(find_tag_by_id(browser.contents, 'branchtable'))
310 None
311
312- >>> print(repr(extract_text(
313- ... find_tag_by_id(browser.contents, 'branch-summary'))))
314- u'There are no branches for the foo package in distro\nin Launchpad.'
315+ >>> print(extract_text(
316+ ... find_tag_by_id(browser.contents, 'branch-summary')))
317+ There are no branches for the foo package in distro
318+ in Launchpad.
319
320 >>> print_tag_with_id(browser.contents, 'distro-branch-warning')
321 This page is for a packaging branch for a program in
322diff --git a/lib/lp/code/stories/feeds/xx-branch-atom.txt b/lib/lp/code/stories/feeds/xx-branch-atom.txt
323index bf4b6bc..9958ac4 100644
324--- a/lib/lp/code/stories/feeds/xx-branch-atom.txt
325+++ b/lib/lp/code/stories/feeds/xx-branch-atom.txt
326@@ -48,8 +48,10 @@ which will include an entry for each branch.
327
328 >>> anon_browser.open('http://feeds.launchpad.test/~mike/branches.atom')
329 >>> _ = feedparser.parse(anon_browser.contents)
330- >>> BeautifulSoup(anon_browser.contents, 'xml').title.contents
331- [u'Branches for Mike Murphy']
332+ >>> for element in BeautifulSoup(
333+ ... anon_browser.contents, 'xml').title.contents:
334+ ... print(element)
335+ Branches for Mike Murphy
336 >>> def print_parse_ids(browser):
337 ... for id in parse_ids(browser.contents):
338 ... print(id)
339@@ -89,8 +91,10 @@ still be hidden:
340
341 >>> anon_browser.open('http://feeds.launchpad.test/~name12/branches.atom')
342 >>> _ = feedparser.parse(anon_browser.contents)
343- >>> BeautifulSoup(anon_browser.contents, 'xml').title.contents
344- [u'Branches for Sample Person']
345+ >>> for element in BeautifulSoup(
346+ ... anon_browser.contents, 'xml').title.contents:
347+ ... print(element)
348+ Branches for Sample Person
349 >>> 'foo@localhost' in anon_browser.contents
350 False
351 >>> 'email address hidden' in anon_browser.contents
352@@ -123,8 +127,9 @@ branches listed, just an id for the feed.
353
354 >>> browser.open('http://feeds.launchpad.test/~landscape-developers/branches.atom')
355 >>> _ = feedparser.parse(browser.contents)
356- >>> BeautifulSoup(browser.contents, 'xml').title.contents
357- [u'Branches for Landscape Developers']
358+ >>> for element in BeautifulSoup(browser.contents, 'xml').title.contents:
359+ ... print(element)
360+ Branches for Landscape Developers
361 >>> print_parse_ids(browser)
362 <id>tag:launchpad.net,2006-07-11:/code/~landscape-developers</id>
363
364@@ -136,8 +141,10 @@ which will include an entry for each branch.
365
366 >>> anon_browser.open('http://feeds.launchpad.test/fooix/branches.atom')
367 >>> _ = feedparser.parse(anon_browser.contents)
368- >>> BeautifulSoup(anon_browser.contents, 'xml').title.contents
369- [u'Branches for Fooix']
370+ >>> for element in BeautifulSoup(
371+ ... anon_browser.contents, 'xml').title.contents:
372+ ... print(element)
373+ Branches for Fooix
374 >>> print_parse_ids(anon_browser)
375 <id>tag:launchpad.net,...:/code/fooix</id>
376 <id>tag:launchpad.net,2007-12-05:/code/~mary/fooix/fifth</id>
377@@ -167,8 +174,10 @@ branches which will include an entry for each branch.
378
379 >>> anon_browser.open('http://feeds.launchpad.test/oh-man/branches.atom')
380 >>> _ = feedparser.parse(anon_browser.contents)
381- >>> BeautifulSoup(anon_browser.contents, 'xml').title.contents
382- [u'Branches for Oh Man']
383+ >>> for element in BeautifulSoup(
384+ ... anon_browser.contents, 'xml').title.contents:
385+ ... print(element)
386+ Branches for Oh Man
387 >>> print_parse_ids(anon_browser)
388 <id>tag:launchpad.net,...:/code/oh-man</id>
389 <id>tag:launchpad.net,2007-12-06:/code/~mary/fooey/sixth</id>
390@@ -202,8 +211,9 @@ different entry.
391 >>> url = 'http://feeds.launchpad.test/~mark/firefox/release--0.9.1/branch.atom'
392 >>> browser.open(url)
393 >>> _ = feedparser.parse(browser.contents)
394- >>> BeautifulSoup(browser.contents, 'xml').title.contents
395- [u'Latest Revisions for Branch lp://dev/~mark/firefox/release--0.9.1']
396+ >>> for element in BeautifulSoup(browser.contents, 'xml').title.contents:
397+ ... print(element)
398+ Latest Revisions for Branch lp://dev/~mark/firefox/release--0.9.1
399 >>> print(browser.url)
400 http://feeds.launchpad.test/~mark/firefox/release--0.9.1/branch.atom
401
402diff --git a/lib/lp/code/stories/feeds/xx-revision-atom.txt b/lib/lp/code/stories/feeds/xx-revision-atom.txt
403index 90f281c..65a6397 100644
404--- a/lib/lp/code/stories/feeds/xx-revision-atom.txt
405+++ b/lib/lp/code/stories/feeds/xx-revision-atom.txt
406@@ -72,8 +72,10 @@ that have been committed by that person (or attributed to that person).
407
408 >>> anon_browser.open('http://feeds.launchpad.test/~mike/revisions.atom')
409 >>> _ = feedparser.parse(anon_browser.contents)
410- >>> BeautifulSoup(anon_browser.contents, 'xml').title.contents
411- [u'Latest Revisions by Mike Murphy']
412+ >>> for element in BeautifulSoup(
413+ ... anon_browser.contents, 'xml').title.contents:
414+ ... print(element)
415+ Latest Revisions by Mike Murphy
416 >>> def print_parse_ids(browser):
417 ... for id in parse_ids(browser.contents):
418 ... print(id)
419@@ -100,8 +102,9 @@ of that team.
420
421 >>> browser.open('http://feeds.launchpad.test/~m-team/revisions.atom')
422 >>> _ = feedparser.parse(browser.contents)
423- >>> BeautifulSoup(browser.contents, 'xml').title.contents
424- [u'Latest Revisions by members of The M Team']
425+ >>> for element in BeautifulSoup(browser.contents, 'xml').title.contents:
426+ ... print(element)
427+ Latest Revisions by members of The M Team
428 >>> print_parse_ids(browser)
429 <id>tag:launchpad.net,...:/code/~m-team</id>
430 <id>tag:launchpad.net,...:/revision/rev3</id>
431@@ -117,8 +120,10 @@ that have been committed on branches for the product.
432
433 >>> anon_browser.open('http://feeds.launchpad.test/fooix/revisions.atom')
434 >>> _ = feedparser.parse(anon_browser.contents)
435- >>> BeautifulSoup(anon_browser.contents, 'xml').title.contents
436- [u'Latest Revisions for Fooix']
437+ >>> for element in BeautifulSoup(
438+ ... anon_browser.contents, 'xml').title.contents:
439+ ... print(element)
440+ Latest Revisions for Fooix
441
442 Ignore the date associated with the id of 'fooix' as this is the date created
443 for the product, which will be different each time the test is run.
444@@ -141,8 +146,10 @@ branch for any product that is associated with the project group.
445
446 >>> anon_browser.open('http://feeds.launchpad.test/fubar/revisions.atom')
447 >>> _ = feedparser.parse(anon_browser.contents)
448- >>> BeautifulSoup(anon_browser.contents, 'xml').title.contents
449- [u'Latest Revisions for Fubar']
450+ >>> for element in BeautifulSoup(
451+ ... anon_browser.contents, 'xml').title.contents:
452+ ... print(element)
453+ Latest Revisions for Fubar
454
455 Ignore the date associated with the id of 'fubar' as this is the date created
456 of the project group, which will be different each time the test is run.

Subscribers

People subscribed via source and target branches

to status/vote changes: