← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-doctest-page-titles into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-doctest-page-titles into launchpad:master.

Commit message:
Fix encoding/decoding of page titles in doctests

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/397688
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-doctest-page-titles into launchpad:master.
diff --git a/lib/lp/answers/stories/question-add-in-other-languages.txt b/lib/lp/answers/stories/question-add-in-other-languages.txt
index 55c7538..a153f2b 100644
--- a/lib/lp/answers/stories/question-add-in-other-languages.txt
+++ b/lib/lp/answers/stories/question-add-in-other-languages.txt
@@ -160,6 +160,6 @@ new question.
     >>> browser.getControl('Post Question').click()
     >>> browser.url
     '.../ubuntu/+question/...'
-    >>> print(browser.title.decode('utf-8'))
+    >>> print(six.ensure_text(browser.title))
     Question #... : Questions : Ubuntu
     >>> portlet = find_tag_by_id(browser.contents, 'portlet-details')
diff --git a/lib/lp/answers/stories/question-message.txt b/lib/lp/answers/stories/question-message.txt
index d101e3d..84444ce 100644
--- a/lib/lp/answers/stories/question-message.txt
+++ b/lib/lp/answers/stories/question-message.txt
@@ -11,7 +11,7 @@ an email post to examine the markup rules. This message contains a
 quoted passage, and a signature with an email address in it.
 
     >>> user_browser.open('http://answers.launchpad.test/ubuntu/+question/11')
-    >>> print(user_browser.title.decode('utf-8'))
+    >>> print(six.ensure_text(user_browser.title))
     Question #11 : ...
 
     >>> user_browser.getControl('Message').value = (
@@ -36,7 +36,7 @@ quoted passage, and a signature with an email address in it.
 Email addresses are visible to authenticated users. Sample Person is
 authenticated already, so they will see 'human@xxxxxxxxxxxxx'.
 
-    >>> print(user_browser.title.decode('utf-8'))
+    >>> print(six.ensure_text(user_browser.title))
     Question #11 :  ...
     >>> text = find_tags_by_class(
     ...     user_browser.contents, 'boardCommentBody')[-1]
diff --git a/lib/lp/bugs/stories/bugs/xx-bug-comments-truncated.txt b/lib/lp/bugs/stories/bugs/xx-bug-comments-truncated.txt
index f421e1a..6bd8170 100644
--- a/lib/lp/bugs/stories/bugs/xx-bug-comments-truncated.txt
+++ b/lib/lp/bugs/stories/bugs/xx-bug-comments-truncated.txt
@@ -86,8 +86,8 @@ the same rules as xx-question-message.txt; changes here may require
 changes to that test.
 
     >>> user_browser.open('http://bugs.launchpad.test/tomcat/+bug/2')
-    >>> user_browser.title.decode('utf-8')
-    u'Bug #2 (blackhole) ... : Bugs : Tomcat'
+    >>> print(six.ensure_text(user_browser.title))
+    Bug #2 (blackhole) ... : Bugs : Tomcat
     >>> user_browser.getControl(name='field.comment').value = (
     ...     "-----BEGIN PGP SIGNED MESSAGE-----\n"
     ...     "Hash: SHA1\n"
@@ -119,8 +119,8 @@ changes to that test.
 No Privileges Person is authenticated in user_browser, so they can see
 email addresses in messages.
 
-    >>> user_browser.title.decode('utf-8')
-    u'Bug #2 (blackhole) ... : Bugs : Tomcat'
+    >>> print(six.ensure_text(user_browser.title))
+    Bug #2 (blackhole) ... : Bugs : Tomcat
     >>> text = find_tags_by_class(
     ...     user_browser.contents, 'boardCommentBody')[-1]
     >>> print(extract_text(text.findAll('p')[-2]))
@@ -134,8 +134,8 @@ address, '<email address hidden>'. The anonymous user is
 unauthenticated, so they will see the obfuscated email address.
 
     >>> anon_browser.open('http://bugs.launchpad.test/tomcat/+bug/2')
-    >>> anon_browser.title.decode('utf-8')
-    u'Bug #2 (blackhole) ... : Bugs : Tomcat'
+    >>> print(six.ensure_text(anon_browser.title))
+    Bug #2 (blackhole) ... : Bugs : Tomcat
     >>> text = find_tags_by_class(
     ...     anon_browser.contents, 'boardCommentBody')[-1]
     >>> print(extract_text(text.findAll('p')[-2]))
diff --git a/lib/lp/registry/doc/distribution-sourcepackage.txt b/lib/lp/registry/doc/distribution-sourcepackage.txt
index c1f1b2f..249d582 100644
--- a/lib/lp/registry/doc/distribution-sourcepackage.txt
+++ b/lib/lp/registry/doc/distribution-sourcepackage.txt
@@ -44,7 +44,7 @@ A distribution source package has a name, displayname, title, and a summary.
     >>> print dsp.displayname
     pmount in Ubuntu
 
-    >>> print dsp.title.encode('ascii', 'ignore')
+    >>> print(dsp.title)
     pmount package in Ubuntu
 
     >>> print dsp.summary
diff --git a/lib/lp/soyuz/stories/soyuz/xx-distroarchseries-binpackages.txt b/lib/lp/soyuz/stories/soyuz/xx-distroarchseries-binpackages.txt
index 4562374..c16c379 100644
--- a/lib/lp/soyuz/stories/soyuz/xx-distroarchseries-binpackages.txt
+++ b/lib/lp/soyuz/stories/soyuz/xx-distroarchseries-binpackages.txt
@@ -45,7 +45,7 @@ As well as a link to the related distribution source package:
     >>> browser.open(
     ...     'http://launchpad.test/ubuntu/warty/i386/mozilla-firefox')
     >>> browser.getLink(id="source_package").click()
-    >>> print(browser.title.decode('ascii', 'ignore'))
+    >>> print(browser.title)
     iceweasel package : Ubuntu
 
 If the binary distribution does not have a current release, then the