Merge ~cjwatson/launchpad:services-worlddata-future-imports into launchpad:master
- Git
- lp:~cjwatson/launchpad
- services-worlddata-future-imports
- Merge into 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) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Thiago F. Pappacena (community) | Approve | ||
Review via email: mp+391091@code.launchpad.net |
Commit message
Convert lp.services.
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/lib/lp/services/worlddata/browser/country.py b/lib/lp/services/worlddata/browser/country.py |
2 | index 61cb1be..0641ff1 100644 |
3 | --- a/lib/lp/services/worlddata/browser/country.py |
4 | +++ b/lib/lp/services/worlddata/browser/country.py |
5 | @@ -1,6 +1,8 @@ |
6 | # Copyright 2010 Canonical Ltd. This software is licensed under the |
7 | # GNU Affero General Public License version 3 (see the file LICENSE). |
8 | |
9 | +from __future__ import absolute_import, print_function, unicode_literals |
10 | + |
11 | from lp.services.webapp import GetitemNavigation |
12 | from lp.services.worlddata.interfaces.country import ICountrySet |
13 | |
14 | diff --git a/lib/lp/services/worlddata/doc/language.txt b/lib/lp/services/worlddata/doc/language.txt |
15 | index fdca7f3..4e36fd2 100644 |
16 | --- a/lib/lp/services/worlddata/doc/language.txt |
17 | +++ b/lib/lp/services/worlddata/doc/language.txt |
18 | @@ -24,12 +24,12 @@ canonicalise_language_code |
19 | |
20 | We can convert language codes to standard form. |
21 | |
22 | - >>> language_set.canonicalise_language_code('pt') |
23 | - 'pt' |
24 | - >>> language_set.canonicalise_language_code('pt_BR') |
25 | - 'pt_BR' |
26 | - >>> language_set.canonicalise_language_code('pt-br') |
27 | - 'pt_BR' |
28 | + >>> print(language_set.canonicalise_language_code('pt')) |
29 | + pt |
30 | + >>> print(language_set.canonicalise_language_code('pt_BR')) |
31 | + pt_BR |
32 | + >>> print(language_set.canonicalise_language_code('pt-br')) |
33 | + pt_BR |
34 | |
35 | codes_to_languages |
36 | ================== |
37 | @@ -50,9 +50,9 @@ createLanguage |
38 | This method creates a new language. |
39 | |
40 | >>> foos = language_set.createLanguage('foos', 'Foo language') |
41 | - >>> print foos.code |
42 | + >>> print(foos.code) |
43 | foos |
44 | - >>> print foos.englishname |
45 | + >>> print(foos.englishname) |
46 | Foo language |
47 | |
48 | search |
49 | @@ -62,7 +62,7 @@ We are able to search languages with this method. |
50 | |
51 | >>> languages = language_set.search('Spanish') |
52 | >>> for language in languages: |
53 | - ... print language.code, language.englishname |
54 | + ... print(language.code, language.englishname) |
55 | es Spanish |
56 | es_AR Spanish (Argentina) |
57 | es_BO Spanish (Bolivia) |
58 | @@ -90,7 +90,7 @@ It's case insensitive: |
59 | |
60 | >>> languages = language_set.search('spanish') |
61 | >>> for language in languages: |
62 | - ... print language.code, language.englishname |
63 | + ... print(language.code, language.englishname) |
64 | es Spanish |
65 | es_AR Spanish (Argentina) |
66 | es_BO Spanish (Bolivia) |
67 | @@ -118,7 +118,7 @@ And it even does substring searching! |
68 | |
69 | >>> languages = language_set.search('panis') |
70 | >>> for language in languages: |
71 | - ... print language.code, language.englishname |
72 | + ... print(language.code, language.englishname) |
73 | es Spanish |
74 | es_AR Spanish (Argentina) |
75 | es_BO Spanish (Bolivia) |
76 | @@ -147,14 +147,14 @@ matching any string: |
77 | |
78 | >>> languages = language_set.search('%') |
79 | >>> for language in languages: |
80 | - ... print language.code, language.englishname |
81 | + ... print(language.code, language.englishname) |
82 | |
83 | Or '_', which means any character match, but we only get strings |
84 | that contain the 'e_' substring: |
85 | |
86 | >>> languages = language_set.search('e_') |
87 | >>> for language in languages: |
88 | - ... print language.code, language.englishname |
89 | + ... print(language.code, language.englishname) |
90 | de_AT German (Austria) |
91 | de_BE German (Belgium) |
92 | de_DE German (Germany) |
93 | @@ -177,23 +177,23 @@ second language. They might not be perfect but they are useful nonetheless. |
94 | pt_BR is not a descendent of pt: |
95 | |
96 | >>> pt_BR = language_set.getLanguageByCode('pt_BR') |
97 | - >>> print pt_BR.alt_suggestion_language |
98 | + >>> print(pt_BR.alt_suggestion_language) |
99 | None |
100 | |
101 | However, es_MX would find es useful: |
102 | |
103 | >>> language = language_set.getLanguageByCode('es_MX') |
104 | - >>> print language.alt_suggestion_language.code |
105 | + >>> print(language.alt_suggestion_language.code) |
106 | es |
107 | |
108 | And Nynorsk and Bokmal have a special relationship: |
109 | |
110 | >>> language = language_set.getLanguageByCode('nn') |
111 | - >>> print language.alt_suggestion_language.code |
112 | + >>> print(language.alt_suggestion_language.code) |
113 | nb |
114 | |
115 | >>> language = language_set.getLanguageByCode('nb') |
116 | - >>> print language.alt_suggestion_language.code |
117 | + >>> print(language.alt_suggestion_language.code) |
118 | nn |
119 | |
120 | English and non-visible languages are not translatable, so there |
121 | @@ -224,7 +224,7 @@ represent, for instance pt_BR, when used on web pages, it should use |
122 | instead a dash char. This method does it automatically: |
123 | |
124 | >>> pt_BR = language_set.getLanguageByCode('pt_BR') |
125 | - >>> print pt_BR.dashedcode |
126 | + >>> print(pt_BR.dashedcode) |
127 | pt-BR |
128 | |
129 | |
130 | @@ -271,7 +271,7 @@ have the language among their preferred languages. |
131 | ... karmavalue=40) |
132 | >>> switch_dbuser('launchpad') |
133 | >>> for translator in sr.translators: |
134 | - ... print translator.name |
135 | + ... print(translator.name) |
136 | serbian-translator-karma-40 |
137 | serbian-translator-karma-30 |
138 | serbian-translator-karma-20 |
139 | @@ -286,7 +286,7 @@ Property holding a list of countries a language is spoken in, and allowing |
140 | reading and setting them. |
141 | |
142 | >>> es = language_set.getLanguageByCode('es') |
143 | - >>> print [country.name for country in es.countries] |
144 | + >>> print([country.name for country in es.countries]) |
145 | [u'Argentina', u'Bolivia', u'Chile', u'Colombia', u'Costa Rica', |
146 | u'Dominican Republic', u'Ecuador', u'El Salvador', u'Guatemala', |
147 | u'Honduras', u'Mexico', u'Nicaragua', u'Panama', u'Paraguay', u'Peru', |
148 | @@ -298,7 +298,7 @@ We can add countries using `ILanguage.addCountry` method. |
149 | >>> country_set = getUtility(ICountrySet) |
150 | >>> germany = country_set['DE'] |
151 | >>> es.addCountry(germany) |
152 | - >>> print [country.name for country in es.countries] |
153 | + >>> print([country.name for country in es.countries]) |
154 | [u'Argentina', u'Bolivia', u'Chile', u'Colombia', u'Costa Rica', |
155 | u'Dominican Republic', u'Ecuador', u'El Salvador', u'Germany', u'Guatemala', |
156 | u'Honduras', u'Mexico', u'Nicaragua', u'Panama', u'Paraguay', u'Peru', |
157 | @@ -308,7 +308,7 @@ Or, we can remove countries using `ILanguage.removeCountry` method. |
158 | |
159 | >>> argentina = country_set['AR'] |
160 | >>> es.removeCountry(argentina) |
161 | - >>> print [country.name for country in es.countries] |
162 | + >>> print([country.name for country in es.countries]) |
163 | [u'Bolivia', u'Chile', u'Colombia', u'Costa Rica', u'Dominican Republic', |
164 | u'Ecuador', u'El Salvador', u'Germany', u'Guatemala', u'Honduras', |
165 | u'Mexico', u'Nicaragua', u'Panama', u'Paraguay', u'Peru', u'Puerto Rico', |
166 | @@ -319,5 +319,5 @@ but we need to log in as a translations administrator first. |
167 | |
168 | >>> login('carlos@canonical.com') |
169 | >>> es.countries = set([argentina, germany]) |
170 | - >>> print [country.name for country in es.countries] |
171 | + >>> print([country.name for country in es.countries]) |
172 | [u'Argentina', u'Germany'] |
173 | diff --git a/lib/lp/services/worlddata/doc/vocabularies.txt b/lib/lp/services/worlddata/doc/vocabularies.txt |
174 | index 2800395..ab100ea 100644 |
175 | --- a/lib/lp/services/worlddata/doc/vocabularies.txt |
176 | +++ b/lib/lp/services/worlddata/doc/vocabularies.txt |
177 | @@ -34,20 +34,20 @@ All the languages known by Launchpad. |
178 | |
179 | >>> es = language_set['es'] |
180 | >>> term = language_vocabulary.getTerm(es) |
181 | - >>> print term.token, term.value.displayname, term.title |
182 | + >>> print(term.token, term.value.displayname, term.title) |
183 | es Spanish (es) Spanish (es) |
184 | |
185 | >>> pt_BR = language_set['pt_BR'] |
186 | >>> term = language_vocabulary.getTerm(pt_BR) |
187 | - >>> print term.token, term.value.displayname, term.title |
188 | + >>> print(term.token, term.value.displayname, term.title) |
189 | pt_BR Portuguese (Brazil) (pt_BR) Portuguese (Brazil) (pt_BR) |
190 | |
191 | >>> term = language_vocabulary.getTermByToken('es') |
192 | - >>> print term.token, term.value.displayname, term.title |
193 | + >>> print(term.token, term.value.displayname, term.title) |
194 | es Spanish (es) Spanish (es) |
195 | |
196 | >>> term = language_vocabulary.getTermByToken('pt_BR') |
197 | - >>> print term.token, term.value.displayname, term.title |
198 | + >>> print(term.token, term.value.displayname, term.title) |
199 | pt_BR Portuguese (Brazil) (pt_BR) Portuguese (Brazil) (pt_BR) |
200 | |
201 | A language token/code may not be used with 'in' tests. |
202 | @@ -81,20 +81,20 @@ when the language is not English and is visible. |
203 | |
204 | >>> es = language_set['es'] |
205 | >>> term = translatable_language_vocabulary.getTerm(es) |
206 | - >>> print term.token, term.value.displayname, term.title |
207 | + >>> print(term.token, term.value.displayname, term.title) |
208 | es Spanish (es) Spanish (es) |
209 | |
210 | >>> pt_BR = language_set['pt_BR'] |
211 | >>> term = translatable_language_vocabulary.getTerm(pt_BR) |
212 | - >>> print term.token, term.value.displayname, term.title |
213 | + >>> print(term.token, term.value.displayname, term.title) |
214 | pt_BR Portuguese (Brazil) (pt_BR) Portuguese (Brazil) (pt_BR) |
215 | |
216 | >>> term = translatable_language_vocabulary.getTermByToken('es') |
217 | - >>> print term.token, term.value.displayname, term.title |
218 | + >>> print(term.token, term.value.displayname, term.title) |
219 | es Spanish (es) Spanish (es) |
220 | |
221 | >>> term = translatable_language_vocabulary.getTermByToken('pt_BR') |
222 | - >>> print term.token, term.value.displayname, term.title |
223 | + >>> print(term.token, term.value.displayname, term.title) |
224 | pt_BR Portuguese (Brazil) (pt_BR) Portuguese (Brazil) (pt_BR) |
225 | |
226 | >>> es in translatable_language_vocabulary |
227 | diff --git a/lib/lp/services/worlddata/helpers.py b/lib/lp/services/worlddata/helpers.py |
228 | index 18c38c4..4c7643d 100644 |
229 | --- a/lib/lp/services/worlddata/helpers.py |
230 | +++ b/lib/lp/services/worlddata/helpers.py |
231 | @@ -3,6 +3,8 @@ |
232 | |
233 | """Worlddata helper functions.""" |
234 | |
235 | +from __future__ import absolute_import, print_function, unicode_literals |
236 | + |
237 | __metaclass__ = type |
238 | __all__ = [ |
239 | 'browser_languages', |
240 | diff --git a/lib/lp/services/worlddata/interfaces/country.py b/lib/lp/services/worlddata/interfaces/country.py |
241 | index a7e087a..1ded91a 100644 |
242 | --- a/lib/lp/services/worlddata/interfaces/country.py |
243 | +++ b/lib/lp/services/worlddata/interfaces/country.py |
244 | @@ -3,6 +3,8 @@ |
245 | |
246 | """Country interfaces.""" |
247 | |
248 | +from __future__ import absolute_import, print_function, unicode_literals |
249 | + |
250 | __metaclass__ = type |
251 | |
252 | __all__ = [ |
253 | diff --git a/lib/lp/services/worlddata/interfaces/language.py b/lib/lp/services/worlddata/interfaces/language.py |
254 | index a283c97..c2ba6af 100644 |
255 | --- a/lib/lp/services/worlddata/interfaces/language.py |
256 | +++ b/lib/lp/services/worlddata/interfaces/language.py |
257 | @@ -3,6 +3,8 @@ |
258 | |
259 | """Language interfaces.""" |
260 | |
261 | +from __future__ import absolute_import, print_function, unicode_literals |
262 | + |
263 | __metaclass__ = type |
264 | |
265 | __all__ = [ |
266 | diff --git a/lib/lp/services/worlddata/interfaces/spokenin.py b/lib/lp/services/worlddata/interfaces/spokenin.py |
267 | index d9d5818..6546067 100644 |
268 | --- a/lib/lp/services/worlddata/interfaces/spokenin.py |
269 | +++ b/lib/lp/services/worlddata/interfaces/spokenin.py |
270 | @@ -5,6 +5,8 @@ |
271 | countries.. |
272 | """ |
273 | |
274 | +from __future__ import absolute_import, print_function, unicode_literals |
275 | + |
276 | __metaclass__ = type |
277 | |
278 | __all__ = ['ISpokenIn'] |
279 | diff --git a/lib/lp/services/worlddata/interfaces/timezone.py b/lib/lp/services/worlddata/interfaces/timezone.py |
280 | index 435e503..25ed2ab 100644 |
281 | --- a/lib/lp/services/worlddata/interfaces/timezone.py |
282 | +++ b/lib/lp/services/worlddata/interfaces/timezone.py |
283 | @@ -1,6 +1,8 @@ |
284 | # Copyright 2009 Canonical Ltd. This software is licensed under the |
285 | # GNU Affero General Public License version 3 (see the file LICENSE). |
286 | |
287 | +from __future__ import absolute_import, print_function, unicode_literals |
288 | + |
289 | __metaclass__ = type |
290 | __all__ = [ |
291 | 'ITimezoneNameVocabulary', |
292 | diff --git a/lib/lp/services/worlddata/interfaces/webservice.py b/lib/lp/services/worlddata/interfaces/webservice.py |
293 | index 009ffca..dc3b900 100644 |
294 | --- a/lib/lp/services/worlddata/interfaces/webservice.py |
295 | +++ b/lib/lp/services/worlddata/interfaces/webservice.py |
296 | @@ -9,6 +9,8 @@ There is a declaration in ZCML somewhere that looks like: |
297 | which tells `lazr.restful` that it should look for webservice exports here. |
298 | """ |
299 | |
300 | +from __future__ import absolute_import, print_function, unicode_literals |
301 | + |
302 | __all__ = [ |
303 | 'ICountry', |
304 | 'ICountrySet', |
305 | diff --git a/lib/lp/services/worlddata/model/country.py b/lib/lp/services/worlddata/model/country.py |
306 | index 55ca6dd..387a84a 100644 |
307 | --- a/lib/lp/services/worlddata/model/country.py |
308 | +++ b/lib/lp/services/worlddata/model/country.py |
309 | @@ -1,9 +1,12 @@ |
310 | # Copyright 2009 Canonical Ltd. This software is licensed under the |
311 | # GNU Affero General Public License version 3 (see the file LICENSE). |
312 | |
313 | +from __future__ import absolute_import, print_function, unicode_literals |
314 | + |
315 | __metaclass__ = type |
316 | __all__ = ['Country', 'CountrySet', 'Continent'] |
317 | |
318 | +import six |
319 | from sqlobject import ( |
320 | ForeignKey, |
321 | SQLRelatedJoin, |
322 | @@ -42,8 +45,8 @@ class Country(SQLBase): |
323 | continent = ForeignKey( |
324 | dbName='continent', foreignKey='Continent', default=None) |
325 | languages = SQLRelatedJoin( |
326 | - 'Language', joinColumn='country', otherColumn='language', |
327 | - intermediateTable='SpokenIn') |
328 | + six.ensure_str('Language'), joinColumn='country', |
329 | + otherColumn='language', intermediateTable='SpokenIn') |
330 | |
331 | |
332 | @implementer(ICountrySet) |
333 | diff --git a/lib/lp/services/worlddata/model/language.py b/lib/lp/services/worlddata/model/language.py |
334 | index 245a686..9142207 100644 |
335 | --- a/lib/lp/services/worlddata/model/language.py |
336 | +++ b/lib/lp/services/worlddata/model/language.py |
337 | @@ -2,6 +2,8 @@ |
338 | # the GNU Affero General Public License version 3 (see the file |
339 | # LICENSE). |
340 | |
341 | +from __future__ import absolute_import, print_function, unicode_literals |
342 | + |
343 | __metaclass__ = type |
344 | __all__ = [ |
345 | 'Language', |
346 | @@ -67,12 +69,12 @@ class Language(SQLBase): |
347 | default=TextDirection.LTR) |
348 | |
349 | translation_teams = SQLRelatedJoin( |
350 | - 'Person', joinColumn="language", |
351 | + six.ensure_str('Person'), joinColumn="language", |
352 | intermediateTable='Translator', otherColumn='translator') |
353 | |
354 | _countries = SQLRelatedJoin( |
355 | - 'Country', joinColumn='language', otherColumn='country', |
356 | - intermediateTable='SpokenIn') |
357 | + six.ensure_str('Country'), joinColumn='language', |
358 | + otherColumn='country', intermediateTable='SpokenIn') |
359 | |
360 | # Define a read/write property `countries` so it can be passed |
361 | # to language administration `LaunchpadFormView`. |
362 | diff --git a/lib/lp/services/worlddata/model/spokenin.py b/lib/lp/services/worlddata/model/spokenin.py |
363 | index ab51568..6d2f06c 100644 |
364 | --- a/lib/lp/services/worlddata/model/spokenin.py |
365 | +++ b/lib/lp/services/worlddata/model/spokenin.py |
366 | @@ -1,6 +1,8 @@ |
367 | # Copyright 2009 Canonical Ltd. This software is licensed under the |
368 | # GNU Affero General Public License version 3 (see the file LICENSE). |
369 | |
370 | +from __future__ import absolute_import, print_function, unicode_literals |
371 | + |
372 | __metaclass__ = type |
373 | __all__ = ['SpokenIn'] |
374 | |
375 | diff --git a/lib/lp/services/worlddata/stories/webservice/xx-country.txt b/lib/lp/services/worlddata/stories/webservice/xx-country.txt |
376 | index 05d8db0..d2aba2d 100644 |
377 | --- a/lib/lp/services/worlddata/stories/webservice/xx-country.txt |
378 | +++ b/lib/lp/services/worlddata/stories/webservice/xx-country.txt |
379 | @@ -4,7 +4,7 @@ At the top level we provide the collection of all countries. |
380 | |
381 | >>> countries = webservice.get("/+countries").jsonBody() |
382 | >>> for entry in countries['entries']: |
383 | - ... print entry['self_link'] |
384 | + ... print(entry['self_link']) |
385 | http://.../+countries/AD |
386 | http://.../+countries/AE |
387 | http://.../+countries/AF |
388 | @@ -28,7 +28,7 @@ And for every country we publish most of its attributes. |
389 | Make sure that invalid countries return 404s and not OOPSes. |
390 | |
391 | >>> bogus_country = "http://api.launchpad.test/beta/+countries/bogus" |
392 | - >>> print webservice.get(bogus_country) |
393 | + >>> print(webservice.get(bogus_country)) |
394 | HTTP/1.1 404 Not Found |
395 | ... |
396 | Object: ..., name: u'bogus' |
397 | @@ -40,7 +40,7 @@ Make sure that invalid countries return 404s and not OOPSes. |
398 | >>> uk = webservice.named_get( |
399 | ... '/+countries', 'getByName', |
400 | ... name='United Kingdom').jsonBody() |
401 | - >>> print uk['self_link'] |
402 | + >>> print(uk['self_link']) |
403 | http://.../+countries/GB |
404 | |
405 | Ensure that unknown/non-existent countries return a None and not an OOPS: |
406 | @@ -48,7 +48,7 @@ Ensure that unknown/non-existent countries return a None and not an OOPS: |
407 | >>> bogus_country_by_name = webservice.named_get( |
408 | ... '/+countries', 'getByName', |
409 | ... name='Klingon Land').jsonBody() |
410 | - >>> print bogus_country_by_name |
411 | + >>> print(bogus_country_by_name) |
412 | None |
413 | |
414 | |
415 | @@ -57,7 +57,7 @@ Ensure that unknown/non-existent countries return a None and not an OOPS: |
416 | >>> au = webservice.named_get( |
417 | ... '/+countries', 'getByCode', |
418 | ... code='AU').jsonBody() |
419 | - >>> print au['self_link'] |
420 | + >>> print(au['self_link']) |
421 | http://.../+countries/AU |
422 | |
423 | Ensure that unknown/non-existent country codes return a None and not an OOPS: |
424 | @@ -65,5 +65,5 @@ Ensure that unknown/non-existent country codes return a None and not an OOPS: |
425 | >>> bogus_country_by_code = webservice.named_get( |
426 | ... '/+countries', 'getByCode', |
427 | ... code='TEST').jsonBody() |
428 | - >>> print bogus_country_by_code |
429 | + >>> print(bogus_country_by_code) |
430 | None |
431 | diff --git a/lib/lp/services/worlddata/stories/webservice/xx-language.txt b/lib/lp/services/worlddata/stories/webservice/xx-language.txt |
432 | index 05401ce..56484ae 100644 |
433 | --- a/lib/lp/services/worlddata/stories/webservice/xx-language.txt |
434 | +++ b/lib/lp/services/worlddata/stories/webservice/xx-language.txt |
435 | @@ -10,19 +10,19 @@ The language information from Launchpad can be queried using |
436 | >>> es = anon_webservice.get('/+languages/es').jsonBody() |
437 | >>> es['resource_type_link'] |
438 | u'http.../#language' |
439 | - >>> print es['text_direction'] |
440 | + >>> print(es['text_direction']) |
441 | Left to Right |
442 | - >>> print es['code'] |
443 | + >>> print(es['code']) |
444 | es |
445 | - >>> print es['english_name'] |
446 | + >>> print(es['english_name']) |
447 | Spanish |
448 | - >>> print es['plural_expression'] |
449 | + >>> print(es['plural_expression']) |
450 | n != 1 |
451 | - >>> print es['plural_forms'] |
452 | + >>> print(es['plural_forms']) |
453 | 2 |
454 | - >>> print es['translators_count'] |
455 | + >>> print(es['translators_count']) |
456 | 1 |
457 | - >>> print es['visible'] |
458 | + >>> print(es['visible']) |
459 | True |
460 | |
461 | |
462 | @@ -45,7 +45,7 @@ at '/+languages'. |
463 | >>> default_languages['resource_type_link'] |
464 | u'http.../#languages' |
465 | >>> languages = get_languages_entries(default_languages) |
466 | - >>> print languages |
467 | + >>> print(languages) |
468 | Abkhazian |
469 | ... |
470 | >>> '(hidden)' in languages |
471 | @@ -60,7 +60,7 @@ default. |
472 | ... '/+languages?' |
473 | ... 'ws.op=getAllLanguages&ws.start=0&ws.size=10' |
474 | ... ).jsonBody() |
475 | - >>> print get_languages_entries(all_languages) |
476 | + >>> print(get_languages_entries(all_languages)) |
477 | Abkhazian |
478 | ... |
479 | Afar (Djibouti)(hidden) |
480 | diff --git a/lib/lp/services/worlddata/tests/test_doc.py b/lib/lp/services/worlddata/tests/test_doc.py |
481 | index 3754618..39f6412 100644 |
482 | --- a/lib/lp/services/worlddata/tests/test_doc.py |
483 | +++ b/lib/lp/services/worlddata/tests/test_doc.py |
484 | @@ -5,10 +5,13 @@ |
485 | Run the doctests and pagetests. |
486 | """ |
487 | |
488 | +from __future__ import absolute_import, print_function, unicode_literals |
489 | + |
490 | import os |
491 | |
492 | from lp.services.testing import build_test_suite |
493 | from lp.testing.layers import LaunchpadZopelessLayer |
494 | +from lp.testing.pages import setUpGlobs |
495 | from lp.testing.systemdocs import ( |
496 | LayeredDocFileSuite, |
497 | setUp, |
498 | @@ -21,9 +24,11 @@ special = { |
499 | 'language.txt': LayeredDocFileSuite( |
500 | '../doc/language.txt', |
501 | layer=LaunchpadZopelessLayer, |
502 | - setUp=setUp, tearDown=tearDown), |
503 | + setUp=lambda test: setUp(test, future=True), tearDown=tearDown), |
504 | } |
505 | |
506 | |
507 | def test_suite(): |
508 | - return build_test_suite(here, special) |
509 | + return build_test_suite( |
510 | + here, special, setUp=lambda test: setUp(test, future=True), |
511 | + pageTestsSetUp=lambda test: setUpGlobs(test, future=True)) |
512 | diff --git a/lib/lp/services/worlddata/tests/test_helpers.py b/lib/lp/services/worlddata/tests/test_helpers.py |
513 | index a129604..a3b8429 100644 |
514 | --- a/lib/lp/services/worlddata/tests/test_helpers.py |
515 | +++ b/lib/lp/services/worlddata/tests/test_helpers.py |
516 | @@ -1,6 +1,8 @@ |
517 | # Copyright 2011 Canonical Ltd. This software is licensed under the |
518 | # GNU Affero General Public License version 3 (see the file LICENSE). |
519 | |
520 | +from __future__ import absolute_import, print_function, unicode_literals |
521 | + |
522 | from doctest import DocTestSuite |
523 | import unittest |
524 | |
525 | @@ -119,8 +121,8 @@ def test_preferred_or_request_languages(): |
526 | >>> languages = preferred_or_request_languages(DummyRequest()) |
527 | >>> len(languages) |
528 | 1 |
529 | - >>> languages[0].code |
530 | - 'es' |
531 | + >>> print(languages[0].code) |
532 | + es |
533 | |
534 | >>> tearDown() |
535 | |
536 | @@ -141,8 +143,8 @@ def test_preferred_or_request_languages(): |
537 | >>> languages = preferred_or_request_languages(DummyRequest()) |
538 | >>> len(languages) |
539 | 6 |
540 | - >>> languages[0].code |
541 | - 'ja' |
542 | + >>> print(languages[0].code) |
543 | + ja |
544 | |
545 | >>> tearDown() |
546 | ''' |
547 | diff --git a/lib/lp/services/worlddata/tests/test_language.py b/lib/lp/services/worlddata/tests/test_language.py |
548 | index b5eafea..797d3d2 100644 |
549 | --- a/lib/lp/services/worlddata/tests/test_language.py |
550 | +++ b/lib/lp/services/worlddata/tests/test_language.py |
551 | @@ -1,6 +1,8 @@ |
552 | # Copyright 2010 Canonical Ltd. This software is licensed under the |
553 | # GNU Affero General Public License version 3 (see the file LICENSE). |
554 | |
555 | +from __future__ import absolute_import, print_function, unicode_literals |
556 | + |
557 | __metaclass__ = type |
558 | |
559 | from lazr.lifecycle.interfaces import IDoNotSnapshot |
LGTM