← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-blueprints-doctest-unicode-strings into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-blueprints-doctest-unicode-strings into launchpad:master.

Commit message:
lp.blueprints: Fix u'...' doctest examples for Python 3

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/396824
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-blueprints-doctest-unicode-strings into launchpad:master.
diff --git a/lib/lp/blueprints/browser/tests/sprintattendance-views.txt b/lib/lp/blueprints/browser/tests/sprintattendance-views.txt
index ea15513..98f835a 100644
--- a/lib/lp/blueprints/browser/tests/sprintattendance-views.txt
+++ b/lib/lp/blueprints/browser/tests/sprintattendance-views.txt
@@ -88,8 +88,9 @@ you wanted the meeting's start and end dates respectively.
 Sample Person is now listed as an attendee.
 
     >>> ubz = getUtility(ISprintSet)['ubz']
-    >>> [attendee.name for attendee in ubz.attendees]
-    [u'name12']
+    >>> for attendee in ubz.attendees:
+    ...     print(attendee.name)
+    name12
 
     >>> sprint_attendance = ubz.attendances[0]
 
diff --git a/lib/lp/blueprints/doc/specgraph.txt b/lib/lp/blueprints/doc/specgraph.txt
index 86d678a..3a57d6e 100644
--- a/lib/lp/blueprints/doc/specgraph.txt
+++ b/lib/lp/blueprints/doc/specgraph.txt
@@ -281,8 +281,8 @@ The SpecificationTreeImageTag view is indirectly called when the spec's
     >>> page_view.initialize()
     >>> content = page_view.render()
     >>> image_start = content.find('<map id="deptree"')
-    >>> content[image_start:image_start + 33]
-    u'<map id="deptree" name="deptree">'
+    >>> print(content[image_start:image_start + 33])
+    <map id="deptree" name="deptree">
 
 
 renderGraphvizGraph() error handling
diff --git a/lib/lp/blueprints/doc/specification-notifications.txt b/lib/lp/blueprints/doc/specification-notifications.txt
index 06c387e..097cf25 100644
--- a/lib/lp/blueprints/doc/specification-notifications.txt
+++ b/lib/lp/blueprints/doc/specification-notifications.txt
@@ -40,14 +40,14 @@ the approver, Cprov, and the drafter, Robert.
     ...     subscription.person for subscription in svg_support.subscriptions]
     >>> related_people_addresses = [
     ...     [person.preferredemail.email] for person in set(related_people)]
-    >>> for addr in sorted(related_people_addresses): print(addr)
-    [u'andrew.bennetts@xxxxxxxxxxxxxxx']
-    [u'carlos@xxxxxxxxxxxxx']
-    [u'celso.providelo@xxxxxxxxxxxxx']
-    [u'daf@xxxxxxxxxxxxx']
-    [u'foo.bar@xxxxxxxxxxxxx']
-    [u'robertc@xxxxxxxxxxxxxxxxx']
-    [u'stuart.bishop@xxxxxxxxxxxxx']
+    >>> for addr in sorted(related_people_addresses): print(pretty(addr))
+    ['andrew.bennetts@xxxxxxxxxxxxxxx']
+    ['carlos@xxxxxxxxxxxxx']
+    ['celso.providelo@xxxxxxxxxxxxx']
+    ['daf@xxxxxxxxxxxxx']
+    ['foo.bar@xxxxxxxxxxxxx']
+    ['robertc@xxxxxxxxxxxxxxxxx']
+    ['stuart.bishop@xxxxxxxxxxxxx']
 
     >>> sent_addresses = sorted(
     ...     [to_addrs for from_addr, to_addrs, message in stub.test_emails])
diff --git a/lib/lp/blueprints/doc/specification.txt b/lib/lp/blueprints/doc/specification.txt
index 92d8382..47b6121 100644
--- a/lib/lp/blueprints/doc/specification.txt
+++ b/lib/lp/blueprints/doc/specification.txt
@@ -38,8 +38,8 @@ To retrieve a specification by its ID, we use `ISpecificationSet.get`.
 
 It should be possible to retrieve a specification by its name
 
-    >>> upstream_firefox.getSpecification('mng').name
-    u'mng'
+    >>> print(upstream_firefox.getSpecification('mng').name)
+    mng
 
 And if we try to retrieve a non-existent specification we should get
 None
@@ -49,8 +49,9 @@ None
 
 It's also possible to retrieve a specification by its URL
 
-    >>> specset.getByURL('http://developer.mozilla.org/en/docs/SVG').specurl
-    u'http://developer.mozilla.org/en/docs/SVG'
+    >>> print(specset.getByURL(
+    ...     'http://developer.mozilla.org/en/docs/SVG').specurl)
+    http://developer.mozilla.org/en/docs/SVG
 
 And if there's no specification with the given URL we should get None
 
@@ -392,8 +393,8 @@ when we do.
     >>> e4x.goal is not None
     True
 
-    >>> e4x.goal_proposer.name
-    u'jdub'
+    >>> print(e4x.goal_proposer.name)
+    jdub
 
     >>> e4x.date_goal_proposed is not None
     True
@@ -415,8 +416,8 @@ We can then accept the goal.
     >>> e4x.goalstatus.title
     'Accepted'
 
-    >>> e4x.goal_decider.name
-    u'mark'
+    >>> print(e4x.goal_decider.name)
+    mark
 
     >>> e4x.date_goal_decided is not None
     True
diff --git a/lib/lp/blueprints/doc/specificationmessage.txt b/lib/lp/blueprints/doc/specificationmessage.txt
index cbeaa9e..d5d944f 100644
--- a/lib/lp/blueprints/doc/specificationmessage.txt
+++ b/lib/lp/blueprints/doc/specificationmessage.txt
@@ -21,8 +21,8 @@ ISpecificationMessageSet.createMessage:
     ...     content="text message content",
     ...     owner=factory.makePerson(),
     ...     spec=factory.makeSpecification())
-    >>> test_message.message.subject
-    u'test message subject'
+    >>> print(test_message.message.subject)
+    test message subject
 
 
 Retrieving specification messages
@@ -35,5 +35,5 @@ ISpecificationMessageSet.get:
     >>> from zope.security.proxy import removeSecurityProxy
     >>> specmessage_one = specmessageset.get(
     ...     removeSecurityProxy(test_message).id)
-    >>> specmessage_one.message.subject
-    u'test message subject'
+    >>> print(specmessage_one.message.subject)
+    test message subject
diff --git a/lib/lp/blueprints/doc/sprint-meeting-export.txt b/lib/lp/blueprints/doc/sprint-meeting-export.txt
index ea315da..51cc5b3 100644
--- a/lib/lp/blueprints/doc/sprint-meeting-export.txt
+++ b/lib/lp/blueprints/doc/sprint-meeting-export.txt
@@ -74,9 +74,11 @@ The person does not show up as interested in the spec though. Only the
 specification assignee is listed (the drafter would be too if one was
 assigned).
 
-    >>> sorted(person['name']
-    ...     for person in view.specifications[1]['interested'])
-    [u'carlos']
+    >>> from operator import itemgetter
+    >>> for person in sorted(
+    ...         view.specifications[1]['interested'], key=itemgetter('name')):
+    ...     print(person['name'])
+    carlos
 
 This is because sample person has not registered as an attendee of the
 sprint.  If we add them as an attendee, then they will be available:
@@ -91,9 +93,11 @@ sprint.  If we add them as an attendee, then they will be available:
     >>> login(ANONYMOUS)
     >>> view = getMultiAdapter((ubz, request), name='+temp-meeting-export')
     >>> view.initialize()
-    >>> sorted(person['name']
-    ...     for person in view.specifications[1]['interested'])
-    [u'carlos', u'name12']
+    >>> for person in sorted(
+    ...         view.specifications[1]['interested'], key=itemgetter('name')):
+    ...     print(person['name'])
+    carlos
+    name12
 
 The person is also included in the list of attendees:
 
diff --git a/lib/lp/blueprints/stories/sprints/xx-sprints.txt b/lib/lp/blueprints/stories/sprints/xx-sprints.txt
index bd0e5c9..5203299 100644
--- a/lib/lp/blueprints/stories/sprints/xx-sprints.txt
+++ b/lib/lp/blueprints/stories/sprints/xx-sprints.txt
@@ -450,6 +450,7 @@ drivers, owners, and admins.
 
 First, we add a couple of IRC nicknames for Carlos.
 
+    >>> from operator import attrgetter
     >>> from lp.testing import login, logout
     >>> from zope.component import getUtility
     >>> from lp.registry.interfaces.person import IPersonSet
@@ -462,8 +463,10 @@ First, we add a couple of IRC nicknames for Carlos.
     >>> IrcID(person=carlos, network='QuakeNet', nickname='qarlos')
     <IrcID at ...>
 
-    >>> sorted([ircid.nickname for ircid in carlos.ircnicknames])
-    [u'carlos', u'qarlos']
+    >>> for ircid in sorted(carlos.ircnicknames, key=attrgetter('nickname')):
+    ...     print(ircid.nickname)
+    carlos
+    qarlos
 
     >>> logout()