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

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 28932aca8f46e2196357a459f11900c91f39f2b0
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:py3-bugs-doctest-unicode-strings-2
Merge into: launchpad:master
Diff against target: 181 lines (+46/-35)
2 files modified
lib/lp/bugs/tests/bugs-emailinterface.txt (+28/-19)
lib/lp/bugs/tests/bugtarget-questiontarget.txt (+18/-16)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+398633@code.launchpad.net

Commit message

lp.bugs: Fix u'...' doctest examples for Python 3 (take 2)

Description of the change

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/bugs/tests/bugs-emailinterface.txt b/lib/lp/bugs/tests/bugs-emailinterface.txt
2index 271e77d..91b0af8 100644
3--- a/lib/lp/bugs/tests/bugs-emailinterface.txt
4+++ b/lib/lp/bugs/tests/bugs-emailinterface.txt
5@@ -242,8 +242,8 @@ unfolded before the bug subject is assigned.
6 >>> process_email(submit_mail)
7 >>> bug = get_latest_added_bug()
8
9- >>> bug.title
10- u'A folded email subject'
11+ >>> print(bug.title)
12+ A folded email subject
13
14
15 Add a comment
16@@ -636,8 +636,8 @@ A timestamp and the user that sets the bug private is also recorded:
17
18 >>> bug_four.date_made_private
19 datetime.datetime(...)
20- >>> bug_four.who_made_private.name
21- u'name12'
22+ >>> print(bug_four.who_made_private.name)
23+ name12
24 >>> bug_attachment.libraryfile.restricted
25 True
26
27@@ -735,8 +735,9 @@ be subscribed. Examples:
28 >>> subscriptions = [subscription.person.name
29 ... for subscription in bug_four.subscriptions]
30 >>> subscriptions.sort()
31- >>> subscriptions
32- [u'name12']
33+ >>> for name in subscriptions:
34+ ... print(name)
35+ name12
36
37
38 >>> submit_commands(bug_four, 'subscribe')
39@@ -802,6 +803,7 @@ Unsubscribing from a bug also unsubscribes you from its duplicates. To
40 demonstrate, let's first make no_privs an indirect subscriber from bug
41 #5, by subscribing them directly to a dupe of bug #5, bug #6.
42
43+ >>> from operator import attrgetter
44 >>> from lp.registry.interfaces.person import IPersonSet
45
46 >>> login("no-priv@canonical.com")
47@@ -812,16 +814,21 @@ demonstrate, let's first make no_privs an indirect subscriber from bug
48 >>> bug_six.duplicateof == bug_five
49 True
50
51- >>> sorted([subscriber.displayname
52- ... for subscriber in bug_five.getIndirectSubscribers()])
53- [u'Sample Person']
54+ >>> for subscriber in sorted(
55+ ... bug_five.getIndirectSubscribers(),
56+ ... key=attrgetter('displayname')):
57+ ... print(subscriber.displayname)
58+ Sample Person
59
60 >>> bug_six.subscribe(no_priv, no_priv)
61 <lp.bugs.model.bugsubscription.BugSubscription ...>
62
63- >>> sorted([subscriber.displayname
64- ... for subscriber in bug_five.getIndirectSubscribers()])
65- [u'No Privileges Person', u'Sample Person']
66+ >>> for subscriber in sorted(
67+ ... bug_five.getIndirectSubscribers(),
68+ ... key=attrgetter('displayname')):
69+ ... print(subscriber.displayname)
70+ No Privileges Person
71+ Sample Person
72
73 Now, if we unsubscribe no-priv from bug #5, they will actually get
74 unsubscribed from bug #6, thus no longer being indirectly subscribed to
75@@ -835,9 +842,11 @@ bug #5.
76 >>> bug_six.isSubscribed(no_priv)
77 False
78
79- >>> sorted([subscriber.displayname
80- ... for subscriber in bug_five.getIndirectSubscribers()])
81- [u'Sample Person']
82+ >>> for subscriber in sorted(
83+ ... bug_five.getIndirectSubscribers(),
84+ ... key=attrgetter('displayname')):
85+ ... print(subscriber.displayname)
86+ Sample Person
87
88 (Log back in for the tests that follow.)
89
90@@ -968,8 +977,8 @@ bug id.
91 The bug id can also be the bug's name.
92
93 >>> submit_commands(bug_four, 'duplicate blackhole')
94- >>> bug_four.duplicateof.name
95- u'blackhole'
96+ >>> print(bug_four.duplicateof.name)
97+ blackhole
98
99 An error message is sent if a nonexistent bug id is given.
100
101@@ -1209,8 +1218,8 @@ Also like the web UI, we can assign a bug to "me", the current user.
102 >>> submit_commands(
103 ... bug_four, 'affects debian',
104 ... 'assignee me')
105- >>> debian_task.assignee.name
106- u'name12'
107+ >>> print(debian_task.assignee.name)
108+ name12
109
110 To set which source package the bug affects, we use:
111
112diff --git a/lib/lp/bugs/tests/bugtarget-questiontarget.txt b/lib/lp/bugs/tests/bugtarget-questiontarget.txt
113index 4e7d564..5a7ae5b 100644
114--- a/lib/lp/bugs/tests/bugtarget-questiontarget.txt
115+++ b/lib/lp/bugs/tests/bugtarget-questiontarget.txt
116@@ -87,14 +87,14 @@ The bug and the question share identical attributes.
117 >>> question.datecreated == bug.datecreated
118 True
119
120- >>> question.owner.displayname
121- u'No Privileges Person'
122+ >>> print(question.owner.displayname)
123+ No Privileges Person
124
125- >>> question.title
126- u'Print is broken'
127+ >>> print(question.title)
128+ Print is broken
129
130- >>> question.description
131- u'Print is broken'
132+ >>> print(question.description)
133+ Print is broken
134
135 The bug's messages are copied to the question. The comment parameter for
136 convertToQuestion is optional. When it is provided, it is added to the
137@@ -109,8 +109,8 @@ bug.
138 >>> question.messages[-1].text_contents == bug.messages[-1].text_contents
139 True
140
141- >>> question.messages[-1].text_contents
142- u'This is a question.'
143+ >>> print(question.messages[-1].text_contents)
144+ This is a question.
145
146 Once converted to a question, the bugtask status is Invalid.
147
148@@ -164,14 +164,16 @@ just the question created from the bug.
149 >>> question in bug.questions
150 True
151
152- >>> bug.title
153- u'Print is broken'
154+ >>> print(bug.title)
155+ Print is broken
156
157- >>> [bug.title for bug in question.bugs]
158- [u'Print is broken']
159+ >>> for bug in question.bugs:
160+ ... print(bug.title)
161+ Print is broken
162
163- >>> [question.title for question in bug.questions]
164- [u'Print is broken']
165+ >>> for question in bug.questions:
166+ ... print(question.title)
167+ Print is broken
168
169
170 Only one bugtask must be valid
171@@ -210,8 +212,8 @@ provided
172 True
173
174 >>> question = big_bug.convertToQuestion(sample_person)
175- >>> question.title
176- u'Print is borked'
177+ >>> print(question.title)
178+ Print is borked
179
180 >>> len(bugtasks) == len([
181 ... bt for bt in bugtasks if bt.status.title == 'Invalid'])

Subscribers

People subscribed via source and target branches

to status/vote changes: