Merge ~cjwatson/launchpad:services-worlddata-future-imports into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: ab261f9b0b6521da2c21bed81feef983c8c641ae
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:services-worlddata-future-imports
Merge into: launchpad:master
Diff against target: 559 lines (+87/-57)
17 files modified
lib/lp/services/worlddata/browser/country.py (+2/-0)
lib/lp/services/worlddata/doc/language.txt (+23/-23)
lib/lp/services/worlddata/doc/vocabularies.txt (+8/-8)
lib/lp/services/worlddata/helpers.py (+2/-0)
lib/lp/services/worlddata/interfaces/country.py (+2/-0)
lib/lp/services/worlddata/interfaces/language.py (+2/-0)
lib/lp/services/worlddata/interfaces/spokenin.py (+2/-0)
lib/lp/services/worlddata/interfaces/timezone.py (+2/-0)
lib/lp/services/worlddata/interfaces/webservice.py (+2/-0)
lib/lp/services/worlddata/model/country.py (+5/-2)
lib/lp/services/worlddata/model/language.py (+5/-3)
lib/lp/services/worlddata/model/spokenin.py (+2/-0)
lib/lp/services/worlddata/stories/webservice/xx-country.txt (+6/-6)
lib/lp/services/worlddata/stories/webservice/xx-language.txt (+9/-9)
lib/lp/services/worlddata/tests/test_doc.py (+7/-2)
lib/lp/services/worlddata/tests/test_helpers.py (+6/-4)
lib/lp/services/worlddata/tests/test_language.py (+2/-0)
Reviewer Review Type Date Requested Status
Thiago F. Pappacena (community) Approve
Review via email: mp+391091@code.launchpad.net

Commit message

Convert lp.services.worlddata to preferred __future__ imports

To post a comment you must log in.
Revision history for this message
Thiago F. Pappacena (pappacena) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/lib/lp/services/worlddata/browser/country.py b/lib/lp/services/worlddata/browser/country.py
index 61cb1be..0641ff1 100644
--- a/lib/lp/services/worlddata/browser/country.py
+++ b/lib/lp/services/worlddata/browser/country.py
@@ -1,6 +1,8 @@
1# Copyright 2010 Canonical Ltd. This software is licensed under the1# Copyright 2010 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4from __future__ import absolute_import, print_function, unicode_literals
5
4from lp.services.webapp import GetitemNavigation6from lp.services.webapp import GetitemNavigation
5from lp.services.worlddata.interfaces.country import ICountrySet7from lp.services.worlddata.interfaces.country import ICountrySet
68
diff --git a/lib/lp/services/worlddata/doc/language.txt b/lib/lp/services/worlddata/doc/language.txt
index fdca7f3..4e36fd2 100644
--- a/lib/lp/services/worlddata/doc/language.txt
+++ b/lib/lp/services/worlddata/doc/language.txt
@@ -24,12 +24,12 @@ canonicalise_language_code
2424
25We can convert language codes to standard form.25We can convert language codes to standard form.
2626
27 >>> language_set.canonicalise_language_code('pt')27 >>> print(language_set.canonicalise_language_code('pt'))
28 'pt'28 pt
29 >>> language_set.canonicalise_language_code('pt_BR')29 >>> print(language_set.canonicalise_language_code('pt_BR'))
30 'pt_BR'30 pt_BR
31 >>> language_set.canonicalise_language_code('pt-br')31 >>> print(language_set.canonicalise_language_code('pt-br'))
32 'pt_BR'32 pt_BR
3333
34codes_to_languages34codes_to_languages
35==================35==================
@@ -50,9 +50,9 @@ createLanguage
50This method creates a new language.50This method creates a new language.
5151
52 >>> foos = language_set.createLanguage('foos', 'Foo language')52 >>> foos = language_set.createLanguage('foos', 'Foo language')
53 >>> print foos.code53 >>> print(foos.code)
54 foos54 foos
55 >>> print foos.englishname55 >>> print(foos.englishname)
56 Foo language56 Foo language
5757
58search58search
@@ -62,7 +62,7 @@ We are able to search languages with this method.
6262
63 >>> languages = language_set.search('Spanish')63 >>> languages = language_set.search('Spanish')
64 >>> for language in languages:64 >>> for language in languages:
65 ... print language.code, language.englishname65 ... print(language.code, language.englishname)
66 es Spanish66 es Spanish
67 es_AR Spanish (Argentina)67 es_AR Spanish (Argentina)
68 es_BO Spanish (Bolivia)68 es_BO Spanish (Bolivia)
@@ -90,7 +90,7 @@ It's case insensitive:
9090
91 >>> languages = language_set.search('spanish')91 >>> languages = language_set.search('spanish')
92 >>> for language in languages:92 >>> for language in languages:
93 ... print language.code, language.englishname93 ... print(language.code, language.englishname)
94 es Spanish94 es Spanish
95 es_AR Spanish (Argentina)95 es_AR Spanish (Argentina)
96 es_BO Spanish (Bolivia)96 es_BO Spanish (Bolivia)
@@ -118,7 +118,7 @@ And it even does substring searching!
118118
119 >>> languages = language_set.search('panis')119 >>> languages = language_set.search('panis')
120 >>> for language in languages:120 >>> for language in languages:
121 ... print language.code, language.englishname121 ... print(language.code, language.englishname)
122 es Spanish122 es Spanish
123 es_AR Spanish (Argentina)123 es_AR Spanish (Argentina)
124 es_BO Spanish (Bolivia)124 es_BO Spanish (Bolivia)
@@ -147,14 +147,14 @@ matching any string:
147147
148 >>> languages = language_set.search('%')148 >>> languages = language_set.search('%')
149 >>> for language in languages:149 >>> for language in languages:
150 ... print language.code, language.englishname150 ... print(language.code, language.englishname)
151151
152Or '_', which means any character match, but we only get strings152Or '_', which means any character match, but we only get strings
153that contain the 'e_' substring:153that contain the 'e_' substring:
154154
155 >>> languages = language_set.search('e_')155 >>> languages = language_set.search('e_')
156 >>> for language in languages:156 >>> for language in languages:
157 ... print language.code, language.englishname157 ... print(language.code, language.englishname)
158 de_AT German (Austria)158 de_AT German (Austria)
159 de_BE German (Belgium)159 de_BE German (Belgium)
160 de_DE German (Germany)160 de_DE German (Germany)
@@ -177,23 +177,23 @@ second language. They might not be perfect but they are useful nonetheless.
177pt_BR is not a descendent of pt:177pt_BR is not a descendent of pt:
178178
179 >>> pt_BR = language_set.getLanguageByCode('pt_BR')179 >>> pt_BR = language_set.getLanguageByCode('pt_BR')
180 >>> print pt_BR.alt_suggestion_language180 >>> print(pt_BR.alt_suggestion_language)
181 None181 None
182182
183However, es_MX would find es useful:183However, es_MX would find es useful:
184184
185 >>> language = language_set.getLanguageByCode('es_MX')185 >>> language = language_set.getLanguageByCode('es_MX')
186 >>> print language.alt_suggestion_language.code186 >>> print(language.alt_suggestion_language.code)
187 es187 es
188188
189And Nynorsk and Bokmal have a special relationship:189And Nynorsk and Bokmal have a special relationship:
190190
191 >>> language = language_set.getLanguageByCode('nn')191 >>> language = language_set.getLanguageByCode('nn')
192 >>> print language.alt_suggestion_language.code192 >>> print(language.alt_suggestion_language.code)
193 nb193 nb
194194
195 >>> language = language_set.getLanguageByCode('nb')195 >>> language = language_set.getLanguageByCode('nb')
196 >>> print language.alt_suggestion_language.code196 >>> print(language.alt_suggestion_language.code)
197 nn197 nn
198198
199English and non-visible languages are not translatable, so there199English and non-visible languages are not translatable, so there
@@ -224,7 +224,7 @@ represent, for instance pt_BR, when used on web pages, it should use
224instead a dash char. This method does it automatically:224instead a dash char. This method does it automatically:
225225
226 >>> pt_BR = language_set.getLanguageByCode('pt_BR')226 >>> pt_BR = language_set.getLanguageByCode('pt_BR')
227 >>> print pt_BR.dashedcode227 >>> print(pt_BR.dashedcode)
228 pt-BR228 pt-BR
229229
230230
@@ -271,7 +271,7 @@ have the language among their preferred languages.
271 ... karmavalue=40)271 ... karmavalue=40)
272 >>> switch_dbuser('launchpad')272 >>> switch_dbuser('launchpad')
273 >>> for translator in sr.translators:273 >>> for translator in sr.translators:
274 ... print translator.name274 ... print(translator.name)
275 serbian-translator-karma-40275 serbian-translator-karma-40
276 serbian-translator-karma-30276 serbian-translator-karma-30
277 serbian-translator-karma-20277 serbian-translator-karma-20
@@ -286,7 +286,7 @@ Property holding a list of countries a language is spoken in, and allowing
286reading and setting them.286reading and setting them.
287287
288 >>> es = language_set.getLanguageByCode('es')288 >>> es = language_set.getLanguageByCode('es')
289 >>> print [country.name for country in es.countries]289 >>> print([country.name for country in es.countries])
290 [u'Argentina', u'Bolivia', u'Chile', u'Colombia', u'Costa Rica',290 [u'Argentina', u'Bolivia', u'Chile', u'Colombia', u'Costa Rica',
291 u'Dominican Republic', u'Ecuador', u'El Salvador', u'Guatemala',291 u'Dominican Republic', u'Ecuador', u'El Salvador', u'Guatemala',
292 u'Honduras', u'Mexico', u'Nicaragua', u'Panama', u'Paraguay', u'Peru',292 u'Honduras', u'Mexico', u'Nicaragua', u'Panama', u'Paraguay', u'Peru',
@@ -298,7 +298,7 @@ We can add countries using `ILanguage.addCountry` method.
298 >>> country_set = getUtility(ICountrySet)298 >>> country_set = getUtility(ICountrySet)
299 >>> germany = country_set['DE']299 >>> germany = country_set['DE']
300 >>> es.addCountry(germany)300 >>> es.addCountry(germany)
301 >>> print [country.name for country in es.countries]301 >>> print([country.name for country in es.countries])
302 [u'Argentina', u'Bolivia', u'Chile', u'Colombia', u'Costa Rica',302 [u'Argentina', u'Bolivia', u'Chile', u'Colombia', u'Costa Rica',
303 u'Dominican Republic', u'Ecuador', u'El Salvador', u'Germany', u'Guatemala',303 u'Dominican Republic', u'Ecuador', u'El Salvador', u'Germany', u'Guatemala',
304 u'Honduras', u'Mexico', u'Nicaragua', u'Panama', u'Paraguay', u'Peru',304 u'Honduras', u'Mexico', u'Nicaragua', u'Panama', u'Paraguay', u'Peru',
@@ -308,7 +308,7 @@ Or, we can remove countries using `ILanguage.removeCountry` method.
308308
309 >>> argentina = country_set['AR']309 >>> argentina = country_set['AR']
310 >>> es.removeCountry(argentina)310 >>> es.removeCountry(argentina)
311 >>> print [country.name for country in es.countries]311 >>> print([country.name for country in es.countries])
312 [u'Bolivia', u'Chile', u'Colombia', u'Costa Rica', u'Dominican Republic',312 [u'Bolivia', u'Chile', u'Colombia', u'Costa Rica', u'Dominican Republic',
313 u'Ecuador', u'El Salvador', u'Germany', u'Guatemala', u'Honduras',313 u'Ecuador', u'El Salvador', u'Germany', u'Guatemala', u'Honduras',
314 u'Mexico', u'Nicaragua', u'Panama', u'Paraguay', u'Peru', u'Puerto Rico',314 u'Mexico', u'Nicaragua', u'Panama', u'Paraguay', u'Peru', u'Puerto Rico',
@@ -319,5 +319,5 @@ but we need to log in as a translations administrator first.
319319
320 >>> login('carlos@canonical.com')320 >>> login('carlos@canonical.com')
321 >>> es.countries = set([argentina, germany])321 >>> es.countries = set([argentina, germany])
322 >>> print [country.name for country in es.countries]322 >>> print([country.name for country in es.countries])
323 [u'Argentina', u'Germany']323 [u'Argentina', u'Germany']
diff --git a/lib/lp/services/worlddata/doc/vocabularies.txt b/lib/lp/services/worlddata/doc/vocabularies.txt
index 2800395..ab100ea 100644
--- a/lib/lp/services/worlddata/doc/vocabularies.txt
+++ b/lib/lp/services/worlddata/doc/vocabularies.txt
@@ -34,20 +34,20 @@ All the languages known by Launchpad.
3434
35 >>> es = language_set['es']35 >>> es = language_set['es']
36 >>> term = language_vocabulary.getTerm(es)36 >>> term = language_vocabulary.getTerm(es)
37 >>> print term.token, term.value.displayname, term.title37 >>> print(term.token, term.value.displayname, term.title)
38 es Spanish (es) Spanish (es)38 es Spanish (es) Spanish (es)
3939
40 >>> pt_BR = language_set['pt_BR']40 >>> pt_BR = language_set['pt_BR']
41 >>> term = language_vocabulary.getTerm(pt_BR)41 >>> term = language_vocabulary.getTerm(pt_BR)
42 >>> print term.token, term.value.displayname, term.title42 >>> print(term.token, term.value.displayname, term.title)
43 pt_BR Portuguese (Brazil) (pt_BR) Portuguese (Brazil) (pt_BR)43 pt_BR Portuguese (Brazil) (pt_BR) Portuguese (Brazil) (pt_BR)
4444
45 >>> term = language_vocabulary.getTermByToken('es')45 >>> term = language_vocabulary.getTermByToken('es')
46 >>> print term.token, term.value.displayname, term.title46 >>> print(term.token, term.value.displayname, term.title)
47 es Spanish (es) Spanish (es)47 es Spanish (es) Spanish (es)
4848
49 >>> term = language_vocabulary.getTermByToken('pt_BR')49 >>> term = language_vocabulary.getTermByToken('pt_BR')
50 >>> print term.token, term.value.displayname, term.title50 >>> print(term.token, term.value.displayname, term.title)
51 pt_BR Portuguese (Brazil) (pt_BR) Portuguese (Brazil) (pt_BR)51 pt_BR Portuguese (Brazil) (pt_BR) Portuguese (Brazil) (pt_BR)
5252
53A language token/code may not be used with 'in' tests.53A language token/code may not be used with 'in' tests.
@@ -81,20 +81,20 @@ when the language is not English and is visible.
8181
82 >>> es = language_set['es']82 >>> es = language_set['es']
83 >>> term = translatable_language_vocabulary.getTerm(es)83 >>> term = translatable_language_vocabulary.getTerm(es)
84 >>> print term.token, term.value.displayname, term.title84 >>> print(term.token, term.value.displayname, term.title)
85 es Spanish (es) Spanish (es)85 es Spanish (es) Spanish (es)
8686
87 >>> pt_BR = language_set['pt_BR']87 >>> pt_BR = language_set['pt_BR']
88 >>> term = translatable_language_vocabulary.getTerm(pt_BR)88 >>> term = translatable_language_vocabulary.getTerm(pt_BR)
89 >>> print term.token, term.value.displayname, term.title89 >>> print(term.token, term.value.displayname, term.title)
90 pt_BR Portuguese (Brazil) (pt_BR) Portuguese (Brazil) (pt_BR)90 pt_BR Portuguese (Brazil) (pt_BR) Portuguese (Brazil) (pt_BR)
9191
92 >>> term = translatable_language_vocabulary.getTermByToken('es')92 >>> term = translatable_language_vocabulary.getTermByToken('es')
93 >>> print term.token, term.value.displayname, term.title93 >>> print(term.token, term.value.displayname, term.title)
94 es Spanish (es) Spanish (es)94 es Spanish (es) Spanish (es)
9595
96 >>> term = translatable_language_vocabulary.getTermByToken('pt_BR')96 >>> term = translatable_language_vocabulary.getTermByToken('pt_BR')
97 >>> print term.token, term.value.displayname, term.title97 >>> print(term.token, term.value.displayname, term.title)
98 pt_BR Portuguese (Brazil) (pt_BR) Portuguese (Brazil) (pt_BR)98 pt_BR Portuguese (Brazil) (pt_BR) Portuguese (Brazil) (pt_BR)
9999
100 >>> es in translatable_language_vocabulary100 >>> es in translatable_language_vocabulary
diff --git a/lib/lp/services/worlddata/helpers.py b/lib/lp/services/worlddata/helpers.py
index 18c38c4..4c7643d 100644
--- a/lib/lp/services/worlddata/helpers.py
+++ b/lib/lp/services/worlddata/helpers.py
@@ -3,6 +3,8 @@
33
4"""Worlddata helper functions."""4"""Worlddata helper functions."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
7__all__ = [9__all__ = [
8 'browser_languages',10 'browser_languages',
diff --git a/lib/lp/services/worlddata/interfaces/country.py b/lib/lp/services/worlddata/interfaces/country.py
index a7e087a..1ded91a 100644
--- a/lib/lp/services/worlddata/interfaces/country.py
+++ b/lib/lp/services/worlddata/interfaces/country.py
@@ -3,6 +3,8 @@
33
4"""Country interfaces."""4"""Country interfaces."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8__all__ = [10__all__ = [
diff --git a/lib/lp/services/worlddata/interfaces/language.py b/lib/lp/services/worlddata/interfaces/language.py
index a283c97..c2ba6af 100644
--- a/lib/lp/services/worlddata/interfaces/language.py
+++ b/lib/lp/services/worlddata/interfaces/language.py
@@ -3,6 +3,8 @@
33
4"""Language interfaces."""4"""Language interfaces."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8__all__ = [10__all__ = [
diff --git a/lib/lp/services/worlddata/interfaces/spokenin.py b/lib/lp/services/worlddata/interfaces/spokenin.py
index d9d5818..6546067 100644
--- a/lib/lp/services/worlddata/interfaces/spokenin.py
+++ b/lib/lp/services/worlddata/interfaces/spokenin.py
@@ -5,6 +5,8 @@
5countries..5countries..
6"""6"""
77
8from __future__ import absolute_import, print_function, unicode_literals
9
8__metaclass__ = type10__metaclass__ = type
911
10__all__ = ['ISpokenIn']12__all__ = ['ISpokenIn']
diff --git a/lib/lp/services/worlddata/interfaces/timezone.py b/lib/lp/services/worlddata/interfaces/timezone.py
index 435e503..25ed2ab 100644
--- a/lib/lp/services/worlddata/interfaces/timezone.py
+++ b/lib/lp/services/worlddata/interfaces/timezone.py
@@ -1,6 +1,8 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the1# Copyright 2009 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4from __future__ import absolute_import, print_function, unicode_literals
5
4__metaclass__ = type6__metaclass__ = type
5__all__ = [7__all__ = [
6 'ITimezoneNameVocabulary',8 'ITimezoneNameVocabulary',
diff --git a/lib/lp/services/worlddata/interfaces/webservice.py b/lib/lp/services/worlddata/interfaces/webservice.py
index 009ffca..dc3b900 100644
--- a/lib/lp/services/worlddata/interfaces/webservice.py
+++ b/lib/lp/services/worlddata/interfaces/webservice.py
@@ -9,6 +9,8 @@ There is a declaration in ZCML somewhere that looks like:
9which tells `lazr.restful` that it should look for webservice exports here.9which tells `lazr.restful` that it should look for webservice exports here.
10"""10"""
1111
12from __future__ import absolute_import, print_function, unicode_literals
13
12__all__ = [14__all__ = [
13 'ICountry',15 'ICountry',
14 'ICountrySet',16 'ICountrySet',
diff --git a/lib/lp/services/worlddata/model/country.py b/lib/lp/services/worlddata/model/country.py
index 55ca6dd..387a84a 100644
--- a/lib/lp/services/worlddata/model/country.py
+++ b/lib/lp/services/worlddata/model/country.py
@@ -1,9 +1,12 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the1# Copyright 2009 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4from __future__ import absolute_import, print_function, unicode_literals
5
4__metaclass__ = type6__metaclass__ = type
5__all__ = ['Country', 'CountrySet', 'Continent']7__all__ = ['Country', 'CountrySet', 'Continent']
68
9import six
7from sqlobject import (10from sqlobject import (
8 ForeignKey,11 ForeignKey,
9 SQLRelatedJoin,12 SQLRelatedJoin,
@@ -42,8 +45,8 @@ class Country(SQLBase):
42 continent = ForeignKey(45 continent = ForeignKey(
43 dbName='continent', foreignKey='Continent', default=None)46 dbName='continent', foreignKey='Continent', default=None)
44 languages = SQLRelatedJoin(47 languages = SQLRelatedJoin(
45 'Language', joinColumn='country', otherColumn='language',48 six.ensure_str('Language'), joinColumn='country',
46 intermediateTable='SpokenIn')49 otherColumn='language', intermediateTable='SpokenIn')
4750
4851
49@implementer(ICountrySet)52@implementer(ICountrySet)
diff --git a/lib/lp/services/worlddata/model/language.py b/lib/lp/services/worlddata/model/language.py
index 245a686..9142207 100644
--- a/lib/lp/services/worlddata/model/language.py
+++ b/lib/lp/services/worlddata/model/language.py
@@ -2,6 +2,8 @@
2# the GNU Affero General Public License version 3 (see the file2# the GNU Affero General Public License version 3 (see the file
3# LICENSE).3# LICENSE).
44
5from __future__ import absolute_import, print_function, unicode_literals
6
5__metaclass__ = type7__metaclass__ = type
6__all__ = [8__all__ = [
7 'Language',9 'Language',
@@ -67,12 +69,12 @@ class Language(SQLBase):
67 default=TextDirection.LTR)69 default=TextDirection.LTR)
6870
69 translation_teams = SQLRelatedJoin(71 translation_teams = SQLRelatedJoin(
70 'Person', joinColumn="language",72 six.ensure_str('Person'), joinColumn="language",
71 intermediateTable='Translator', otherColumn='translator')73 intermediateTable='Translator', otherColumn='translator')
7274
73 _countries = SQLRelatedJoin(75 _countries = SQLRelatedJoin(
74 'Country', joinColumn='language', otherColumn='country',76 six.ensure_str('Country'), joinColumn='language',
75 intermediateTable='SpokenIn')77 otherColumn='country', intermediateTable='SpokenIn')
7678
77 # Define a read/write property `countries` so it can be passed79 # Define a read/write property `countries` so it can be passed
78 # to language administration `LaunchpadFormView`.80 # to language administration `LaunchpadFormView`.
diff --git a/lib/lp/services/worlddata/model/spokenin.py b/lib/lp/services/worlddata/model/spokenin.py
index ab51568..6d2f06c 100644
--- a/lib/lp/services/worlddata/model/spokenin.py
+++ b/lib/lp/services/worlddata/model/spokenin.py
@@ -1,6 +1,8 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the1# Copyright 2009 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4from __future__ import absolute_import, print_function, unicode_literals
5
4__metaclass__ = type6__metaclass__ = type
5__all__ = ['SpokenIn']7__all__ = ['SpokenIn']
68
diff --git a/lib/lp/services/worlddata/stories/webservice/xx-country.txt b/lib/lp/services/worlddata/stories/webservice/xx-country.txt
index 05d8db0..d2aba2d 100644
--- a/lib/lp/services/worlddata/stories/webservice/xx-country.txt
+++ b/lib/lp/services/worlddata/stories/webservice/xx-country.txt
@@ -4,7 +4,7 @@ At the top level we provide the collection of all countries.
44
5 >>> countries = webservice.get("/+countries").jsonBody()5 >>> countries = webservice.get("/+countries").jsonBody()
6 >>> for entry in countries['entries']:6 >>> for entry in countries['entries']:
7 ... print entry['self_link']7 ... print(entry['self_link'])
8 http://.../+countries/AD8 http://.../+countries/AD
9 http://.../+countries/AE9 http://.../+countries/AE
10 http://.../+countries/AF10 http://.../+countries/AF
@@ -28,7 +28,7 @@ And for every country we publish most of its attributes.
28Make sure that invalid countries return 404s and not OOPSes.28Make sure that invalid countries return 404s and not OOPSes.
2929
30 >>> bogus_country = "http://api.launchpad.test/beta/+countries/bogus"30 >>> bogus_country = "http://api.launchpad.test/beta/+countries/bogus"
31 >>> print webservice.get(bogus_country)31 >>> print(webservice.get(bogus_country))
32 HTTP/1.1 404 Not Found32 HTTP/1.1 404 Not Found
33 ...33 ...
34 Object: ..., name: u'bogus'34 Object: ..., name: u'bogus'
@@ -40,7 +40,7 @@ Make sure that invalid countries return 404s and not OOPSes.
40 >>> uk = webservice.named_get(40 >>> uk = webservice.named_get(
41 ... '/+countries', 'getByName',41 ... '/+countries', 'getByName',
42 ... name='United Kingdom').jsonBody()42 ... name='United Kingdom').jsonBody()
43 >>> print uk['self_link']43 >>> print(uk['self_link'])
44 http://.../+countries/GB44 http://.../+countries/GB
4545
46Ensure that unknown/non-existent countries return a None and not an OOPS:46Ensure that unknown/non-existent countries return a None and not an OOPS:
@@ -48,7 +48,7 @@ Ensure that unknown/non-existent countries return a None and not an OOPS:
48 >>> bogus_country_by_name = webservice.named_get(48 >>> bogus_country_by_name = webservice.named_get(
49 ... '/+countries', 'getByName',49 ... '/+countries', 'getByName',
50 ... name='Klingon Land').jsonBody()50 ... name='Klingon Land').jsonBody()
51 >>> print bogus_country_by_name51 >>> print(bogus_country_by_name)
52 None52 None
5353
5454
@@ -57,7 +57,7 @@ Ensure that unknown/non-existent countries return a None and not an OOPS:
57 >>> au = webservice.named_get(57 >>> au = webservice.named_get(
58 ... '/+countries', 'getByCode',58 ... '/+countries', 'getByCode',
59 ... code='AU').jsonBody()59 ... code='AU').jsonBody()
60 >>> print au['self_link']60 >>> print(au['self_link'])
61 http://.../+countries/AU61 http://.../+countries/AU
6262
63Ensure that unknown/non-existent country codes return a None and not an OOPS:63Ensure that unknown/non-existent country codes return a None and not an OOPS:
@@ -65,5 +65,5 @@ Ensure that unknown/non-existent country codes return a None and not an OOPS:
65 >>> bogus_country_by_code = webservice.named_get(65 >>> bogus_country_by_code = webservice.named_get(
66 ... '/+countries', 'getByCode',66 ... '/+countries', 'getByCode',
67 ... code='TEST').jsonBody()67 ... code='TEST').jsonBody()
68 >>> print bogus_country_by_code68 >>> print(bogus_country_by_code)
69 None69 None
diff --git a/lib/lp/services/worlddata/stories/webservice/xx-language.txt b/lib/lp/services/worlddata/stories/webservice/xx-language.txt
index 05401ce..56484ae 100644
--- a/lib/lp/services/worlddata/stories/webservice/xx-language.txt
+++ b/lib/lp/services/worlddata/stories/webservice/xx-language.txt
@@ -10,19 +10,19 @@ The language information from Launchpad can be queried using
10 >>> es = anon_webservice.get('/+languages/es').jsonBody()10 >>> es = anon_webservice.get('/+languages/es').jsonBody()
11 >>> es['resource_type_link']11 >>> es['resource_type_link']
12 u'http.../#language'12 u'http.../#language'
13 >>> print es['text_direction']13 >>> print(es['text_direction'])
14 Left to Right14 Left to Right
15 >>> print es['code']15 >>> print(es['code'])
16 es16 es
17 >>> print es['english_name']17 >>> print(es['english_name'])
18 Spanish18 Spanish
19 >>> print es['plural_expression']19 >>> print(es['plural_expression'])
20 n != 120 n != 1
21 >>> print es['plural_forms']21 >>> print(es['plural_forms'])
22 222 2
23 >>> print es['translators_count']23 >>> print(es['translators_count'])
24 124 1
25 >>> print es['visible']25 >>> print(es['visible'])
26 True26 True
2727
2828
@@ -45,7 +45,7 @@ at '/+languages'.
45 >>> default_languages['resource_type_link']45 >>> default_languages['resource_type_link']
46 u'http.../#languages'46 u'http.../#languages'
47 >>> languages = get_languages_entries(default_languages)47 >>> languages = get_languages_entries(default_languages)
48 >>> print languages48 >>> print(languages)
49 Abkhazian49 Abkhazian
50 ...50 ...
51 >>> '(hidden)' in languages51 >>> '(hidden)' in languages
@@ -60,7 +60,7 @@ default.
60 ... '/+languages?'60 ... '/+languages?'
61 ... 'ws.op=getAllLanguages&ws.start=0&ws.size=10'61 ... 'ws.op=getAllLanguages&ws.start=0&ws.size=10'
62 ... ).jsonBody()62 ... ).jsonBody()
63 >>> print get_languages_entries(all_languages)63 >>> print(get_languages_entries(all_languages))
64 Abkhazian64 Abkhazian
65 ...65 ...
66 Afar (Djibouti)(hidden)66 Afar (Djibouti)(hidden)
diff --git a/lib/lp/services/worlddata/tests/test_doc.py b/lib/lp/services/worlddata/tests/test_doc.py
index 3754618..39f6412 100644
--- a/lib/lp/services/worlddata/tests/test_doc.py
+++ b/lib/lp/services/worlddata/tests/test_doc.py
@@ -5,10 +5,13 @@
5Run the doctests and pagetests.5Run the doctests and pagetests.
6"""6"""
77
8from __future__ import absolute_import, print_function, unicode_literals
9
8import os10import os
911
10from lp.services.testing import build_test_suite12from lp.services.testing import build_test_suite
11from lp.testing.layers import LaunchpadZopelessLayer13from lp.testing.layers import LaunchpadZopelessLayer
14from lp.testing.pages import setUpGlobs
12from lp.testing.systemdocs import (15from lp.testing.systemdocs import (
13 LayeredDocFileSuite,16 LayeredDocFileSuite,
14 setUp,17 setUp,
@@ -21,9 +24,11 @@ special = {
21 'language.txt': LayeredDocFileSuite(24 'language.txt': LayeredDocFileSuite(
22 '../doc/language.txt',25 '../doc/language.txt',
23 layer=LaunchpadZopelessLayer,26 layer=LaunchpadZopelessLayer,
24 setUp=setUp, tearDown=tearDown),27 setUp=lambda test: setUp(test, future=True), tearDown=tearDown),
25 }28 }
2629
2730
28def test_suite():31def test_suite():
29 return build_test_suite(here, special)32 return build_test_suite(
33 here, special, setUp=lambda test: setUp(test, future=True),
34 pageTestsSetUp=lambda test: setUpGlobs(test, future=True))
diff --git a/lib/lp/services/worlddata/tests/test_helpers.py b/lib/lp/services/worlddata/tests/test_helpers.py
index a129604..a3b8429 100644
--- a/lib/lp/services/worlddata/tests/test_helpers.py
+++ b/lib/lp/services/worlddata/tests/test_helpers.py
@@ -1,6 +1,8 @@
1# Copyright 2011 Canonical Ltd. This software is licensed under the1# Copyright 2011 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4from __future__ import absolute_import, print_function, unicode_literals
5
4from doctest import DocTestSuite6from doctest import DocTestSuite
5import unittest7import unittest
68
@@ -119,8 +121,8 @@ def test_preferred_or_request_languages():
119 >>> languages = preferred_or_request_languages(DummyRequest())121 >>> languages = preferred_or_request_languages(DummyRequest())
120 >>> len(languages)122 >>> len(languages)
121 1123 1
122 >>> languages[0].code124 >>> print(languages[0].code)
123 'es'125 es
124126
125 >>> tearDown()127 >>> tearDown()
126128
@@ -141,8 +143,8 @@ def test_preferred_or_request_languages():
141 >>> languages = preferred_or_request_languages(DummyRequest())143 >>> languages = preferred_or_request_languages(DummyRequest())
142 >>> len(languages)144 >>> len(languages)
143 6145 6
144 >>> languages[0].code146 >>> print(languages[0].code)
145 'ja'147 ja
146148
147 >>> tearDown()149 >>> tearDown()
148 '''150 '''
diff --git a/lib/lp/services/worlddata/tests/test_language.py b/lib/lp/services/worlddata/tests/test_language.py
index b5eafea..797d3d2 100644
--- a/lib/lp/services/worlddata/tests/test_language.py
+++ b/lib/lp/services/worlddata/tests/test_language.py
@@ -1,6 +1,8 @@
1# Copyright 2010 Canonical Ltd. This software is licensed under the1# Copyright 2010 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4from __future__ import absolute_import, print_function, unicode_literals
5
4__metaclass__ = type6__metaclass__ = type
57
6from lazr.lifecycle.interfaces import IDoNotSnapshot8from lazr.lifecycle.interfaces import IDoNotSnapshot

Subscribers

People subscribed via source and target branches

to status/vote changes: