Merge ~cjwatson/launchpad:py3-translations-utilities-doctests-future-imports into launchpad:master
- Git
- lp:~cjwatson/launchpad
- py3-translations-utilities-doctests-future-imports
- Merge into master
Proposed by
Colin Watson
Status: | Merged |
---|---|
Approved by: | Colin Watson |
Approved revision: | 27586adf1996fe6f6280bc398eb42a7a34af2c7d |
Merge reported by: | Otto Co-Pilot |
Merged at revision: | not available |
Proposed branch: | ~cjwatson/launchpad:py3-translations-utilities-doctests-future-imports |
Merge into: | launchpad:master |
Diff against target: |
565 lines (+77/-75) 7 files modified
lib/lp/translations/utilities/doc/gettext_po_exporter.txt (+9/-9) lib/lp/translations/utilities/doc/gettext_po_parser.txt (+9/-9) lib/lp/translations/utilities/doc/gettext_po_parser_context.txt (+19/-19) lib/lp/translations/utilities/doc/kde-po-file-format.txt (+27/-27) lib/lp/translations/utilities/doc/pluralforms.txt (+1/-1) lib/lp/translations/utilities/doc/templatenames.txt (+8/-8) lib/lp/translations/utilities/tests/test_system_documentation.py (+4/-2) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson (community) | Approve | ||
Review via email: mp+397979@code.launchpad.net |
Commit message
Convert lp.translations
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/translations/utilities/doc/gettext_po_exporter.txt b/lib/lp/translations/utilities/doc/gettext_po_exporter.txt |
2 | index 4d3a74c..51536cf 100644 |
3 | --- a/lib/lp/translations/utilities/doc/gettext_po_exporter.txt |
4 | +++ b/lib/lp/translations/utilities/doc/gettext_po_exporter.txt |
5 | @@ -151,7 +151,7 @@ It's time to test the wrapping with the '-' char: |
6 | ... TranslationConstants.SINGULAR_FORM, |
7 | ... u"WARNUNG: Unsichere Zugriffsrechte des umgebenden Verzeichnisses" |
8 | ... u" des Home-Verzeichnisses `%s'\n") |
9 | - >>> print export_translation_message(translation_message) |
10 | + >>> print(export_translation_message(translation_message)) |
11 | msgid "WARNING: unsafe enclosing directory permissions on homedir `%s'\n" |
12 | msgstr "" |
13 | "WARNUNG: Unsichere Zugriffsrechte des umgebenden Verzeichnisses des Home-" |
14 | @@ -163,7 +163,7 @@ When we changed the wrapping code, we got a bug with this string. |
15 | >>> translation_message.msgid_singular = ( |
16 | ... u"The location and hierarchy of the Evolution contact folders has" |
17 | ... u" changed since Evolution 1.x.\n\n") |
18 | - >>> print export_translation_message(translation_message) |
19 | + >>> print(export_translation_message(translation_message)) |
20 | msgid "" |
21 | "The location and hierarchy of the Evolution contact folders has changed " |
22 | "since Evolution 1.x.\n" |
23 | @@ -177,7 +177,7 @@ creating a broken PO message. This is the test for bug #46156. |
24 | >>> translation_message = TranslationMessageData() |
25 | >>> translation_message.msgid_singular = ( |
26 | ... u"1234567890abcde word\"1234567890abcdefghij") |
27 | - >>> print export_translation_message(translation_message, wrap_width=20) |
28 | + >>> print(export_translation_message(translation_message, wrap_width=20)) |
29 | msgid "" |
30 | "1234567890abcde " |
31 | "word\"1234567890abcd" |
32 | @@ -191,7 +191,7 @@ like \" or \\: |
33 | >>> translation_message = TranslationMessageData() |
34 | >>> translation_message.msgid_singular = ( |
35 | ... u"1234567890abcdefghij\\klmno") |
36 | - >>> print export_translation_message(translation_message, wrap_width=20) |
37 | + >>> print(export_translation_message(translation_message, wrap_width=20)) |
38 | msgid "" |
39 | "1234567890abcdefghij" |
40 | "\\klmno" |
41 | @@ -200,7 +200,7 @@ like \" or \\: |
42 | >>> translation_message = TranslationMessageData() |
43 | >>> translation_message.msgid_singular = ( |
44 | ... u"1234567890abcdefgh\\ijklmno") |
45 | - >>> print export_translation_message(translation_message, wrap_width=20) |
46 | + >>> print(export_translation_message(translation_message, wrap_width=20)) |
47 | msgid "" |
48 | "1234567890abcdefgh\\" |
49 | "ijklmno" |
50 | @@ -209,7 +209,7 @@ like \" or \\: |
51 | >>> translation_message = TranslationMessageData() |
52 | >>> translation_message.msgid_singular = ( |
53 | ... u"1234567890abcdefg\\\\hijklmno") |
54 | - >>> print export_translation_message(translation_message, wrap_width=20) |
55 | + >>> print(export_translation_message(translation_message, wrap_width=20)) |
56 | msgid "" |
57 | "1234567890abcdefg\\" |
58 | "\\hijklmno" |
59 | @@ -220,14 +220,14 @@ For compatibility with msgcat -w, it also wraps on \\ properly. |
60 | >>> translation_message = TranslationMessageData() |
61 | >>> translation_message.msgid_singular = ( |
62 | ... u"\\\\\\\\\\") |
63 | - >>> print export_translation_message(translation_message, wrap_width=5) |
64 | + >>> print(export_translation_message(translation_message, wrap_width=5)) |
65 | msgid "" |
66 | "\\\\" |
67 | "\\\\" |
68 | "\\" |
69 | msgstr "" |
70 | |
71 | - >>> print export_translation_message(translation_message, wrap_width=6) |
72 | + >>> print(export_translation_message(translation_message, wrap_width=6)) |
73 | msgid "" |
74 | "\\\\\\" |
75 | "\\\\" |
76 | @@ -237,7 +237,7 @@ There are a couple of other characters that will be escaped in the |
77 | output, too. |
78 | |
79 | >>> translation_message.msgid_singular = (u'"\t\r') |
80 | - >>> print export_translation_message(translation_message, wrap_width=10) |
81 | + >>> print(export_translation_message(translation_message, wrap_width=10)) |
82 | msgid "" |
83 | "\"\t\r" |
84 | msgstr "" |
85 | diff --git a/lib/lp/translations/utilities/doc/gettext_po_parser.txt b/lib/lp/translations/utilities/doc/gettext_po_parser.txt |
86 | index 8ce9e60..34b3082 100644 |
87 | --- a/lib/lp/translations/utilities/doc/gettext_po_parser.txt |
88 | +++ b/lib/lp/translations/utilities/doc/gettext_po_parser.txt |
89 | @@ -99,14 +99,14 @@ POHeader. |
90 | |
91 | Plural forms are now the default ones. No plural forms. |
92 | |
93 | - >>> print new_header.plural_form_expression |
94 | + >>> print(new_header.plural_form_expression) |
95 | 0 |
96 | >>> new_header.number_plural_forms |
97 | 1 |
98 | |
99 | And the translation_revision_date is exactly the one in the header string. |
100 | |
101 | - >>> print new_header.translation_revision_date |
102 | + >>> print(new_header.translation_revision_date) |
103 | 2005-08-18 13:22:00+00:00 |
104 | |
105 | |
106 | @@ -140,7 +140,7 @@ It defaults to None. |
107 | ... Content-Type: text/plain; charset=UTF-8 |
108 | ... Content-Transfer-Encoding: 8bit |
109 | ... """) |
110 | - >>> print header.translation_revision_date |
111 | + >>> print(header.translation_revision_date) |
112 | None |
113 | |
114 | |
115 | @@ -157,7 +157,7 @@ valid header but no revision date. |
116 | ... Content-Type: text/plain; charset=UTF-8 |
117 | ... Content-Transfer-Encoding: 8bit |
118 | ... """) |
119 | - >>> print header.translation_revision_date |
120 | + >>> print(header.translation_revision_date) |
121 | None |
122 | |
123 | |
124 | @@ -174,7 +174,7 @@ Likewise, if the PO-Revision-Date header is semantically nonsensical |
125 | ... Content-Type: text/plain; charset=UTF-8 |
126 | ... Content-Transfer-Encoding: 8bit |
127 | ... """) |
128 | - >>> print header.translation_revision_date |
129 | + >>> print(header.translation_revision_date) |
130 | None |
131 | |
132 | |
133 | @@ -214,7 +214,7 @@ and a translation header with some fields set. |
134 | Once we do the update, the resulting output will be a mix between both headers. |
135 | |
136 | >>> translation_header.updateFromTemplateHeader(template_header) |
137 | - >>> print translation_header.getRawContent() |
138 | + >>> print(translation_header.getRawContent()) |
139 | Project-Id-Version: PACKAGE VERSION |
140 | Report-Msgid-Bugs-To: |
141 | POT-Creation-Date: 2007-07-09 03:39+0100 |
142 | @@ -231,7 +231,7 @@ If the header knows there are plural forms, the plural form information |
143 | will appear in the export. |
144 | |
145 | >>> translation_header.has_plural_forms = True |
146 | - >>> print translation_header.getRawContent() |
147 | + >>> print(translation_header.getRawContent()) |
148 | Project-Id-Version: PACKAGE VERSION |
149 | Report-Msgid-Bugs-To: |
150 | POT-Creation-Date: 2007-07-09 03:39+0100 |
151 | @@ -263,7 +263,7 @@ template. |
152 | ... Domain: blahdomain |
153 | ... """) |
154 | >>> translation_header.updateFromTemplateHeader(template_header) |
155 | - >>> print translation_header.getRawContent() |
156 | + >>> print(translation_header.getRawContent()) |
157 | Project-Id-Version: PACKAGE VERSION |
158 | Report-Msgid-Bugs-To: |
159 | POT-Creation-Date: 2007-07-09 03:39+0100 |
160 | @@ -305,7 +305,7 @@ Parsing a PO template: |
161 | |
162 | >>> len(translation_file.messages) |
163 | 1 |
164 | - >>> print translation_file.messages[0].msgid_singular |
165 | + >>> print(translation_file.messages[0].msgid_singular) |
166 | Foo |
167 | |
168 | PO templates, and other PO files that do not specify their encoding, |
169 | diff --git a/lib/lp/translations/utilities/doc/gettext_po_parser_context.txt b/lib/lp/translations/utilities/doc/gettext_po_parser_context.txt |
170 | index 09e061d..f096aa6 100644 |
171 | --- a/lib/lp/translations/utilities/doc/gettext_po_parser_context.txt |
172 | +++ b/lib/lp/translations/utilities/doc/gettext_po_parser_context.txt |
173 | @@ -86,7 +86,7 @@ This file can now be correctly imported: |
174 | |
175 | >>> entry = import_pofile_or_potemplate(potemplate_contents, carlos, |
176 | ... potemplate=potemplate) |
177 | - >>> print entry.status.name |
178 | + >>> print(entry.status.name) |
179 | IMPORTED |
180 | >>> flush_database_caches() # replace date SQL constant with real date |
181 | |
182 | @@ -94,40 +94,40 @@ The method getPOTMsgSetByMsgIDText returns a message without context if |
183 | no context is specified. |
184 | |
185 | >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'bar') |
186 | - >>> print potmsgset.singular_text |
187 | + >>> print(potmsgset.singular_text) |
188 | bar |
189 | - >>> print potmsgset.context |
190 | + >>> print(potmsgset.context) |
191 | None |
192 | |
193 | And if all the messages have a context, getPOTMsgSetByMsgIDText returns |
194 | nothing when context is not specified. |
195 | |
196 | >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'%d file') |
197 | - >>> print potmsgset |
198 | + >>> print(potmsgset) |
199 | None |
200 | |
201 | To get a message with a context, we pass a context parameter. |
202 | |
203 | >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'bar', |
204 | ... context=u'context') |
205 | - >>> print potmsgset.singular_text |
206 | + >>> print(potmsgset.singular_text) |
207 | bar |
208 | - >>> print potmsgset.context |
209 | + >>> print(potmsgset.context) |
210 | context |
211 | |
212 | It also works for plural form messages. |
213 | |
214 | >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'%d file', |
215 | ... context=u'First message') |
216 | - >>> print potmsgset.singular_text |
217 | + >>> print(potmsgset.singular_text) |
218 | %d file |
219 | - >>> print potmsgset.context |
220 | + >>> print(potmsgset.context) |
221 | First message |
222 | >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'%d file', u'%d files', |
223 | ... context=u'Second message') |
224 | - >>> print potmsgset.singular_text |
225 | + >>> print(potmsgset.singular_text) |
226 | %d file |
227 | - >>> print potmsgset.context |
228 | + >>> print(potmsgset.context) |
229 | Second message |
230 | |
231 | Importing a PO template with two messages with identical strings, but no |
232 | @@ -156,7 +156,7 @@ Importing this file fails because of conflicting messages. |
233 | ... potemplate=potemplate) |
234 | INFO We got an error import... |
235 | ...duplicate msgid... |
236 | - >>> print entry.status.name |
237 | + >>> print(entry.status.name) |
238 | FAILED |
239 | |
240 | == Importing PO files == |
241 | @@ -199,7 +199,7 @@ Importing this file succeeds. |
242 | |
243 | >>> entry = import_pofile_or_potemplate(pofile_contents, carlos, |
244 | ... pofile=pofile) |
245 | - >>> print entry.status.name |
246 | + >>> print(entry.status.name) |
247 | IMPORTED |
248 | >>> flush_database_caches() # replace date SQL constant with real date |
249 | |
250 | @@ -225,7 +225,7 @@ a message with context. |
251 | If message has a context, you cannot get it without specifying the context: |
252 | |
253 | >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'%file') |
254 | - >>> print potmsgset |
255 | + >>> print(potmsgset) |
256 | None |
257 | |
258 | If you specify context, it actually works. |
259 | @@ -251,7 +251,7 @@ And for messages with plural forms, it gets all the translations. |
260 | Make sure exported files are correct. Exporting a POT file returns exactly |
261 | the same contents, except that header is marked fuzzy. |
262 | |
263 | - >>> print potemplate.export() |
264 | + >>> print(potemplate.export()) |
265 | #, fuzzy |
266 | msgid "" |
267 | msgstr "" |
268 | @@ -293,7 +293,7 @@ And a Serbian PO file is exported using regular export_pofile call. |
269 | It's different from the imported file only in a few headers. |
270 | |
271 | >>> pofile = potemplate.getPOFileByLang('sr') |
272 | - >>> print pofile.export().decode('UTF-8') |
273 | + >>> print(pofile.export().decode('UTF-8')) |
274 | msgid "" |
275 | msgstr "" |
276 | "Project-Id-Version: PACKAGE VERSION\n" |
277 | @@ -358,7 +358,7 @@ This file can now be correctly imported: |
278 | |
279 | >>> entry = import_pofile_or_potemplate(potemplate_contents, carlos, |
280 | ... potemplate=potemplate) |
281 | - >>> print entry.status.name |
282 | + >>> print(entry.status.name) |
283 | IMPORTED |
284 | >>> flush_database_caches() # replace date SQL constant with real date |
285 | |
286 | @@ -366,16 +366,16 @@ The method getPOTMsgSetByMsgIDText returns a message without context if |
287 | no context is specified. |
288 | |
289 | >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'bar') |
290 | - >>> print potmsgset.singular_text |
291 | + >>> print(potmsgset.singular_text) |
292 | bar |
293 | - >>> print potmsgset.context |
294 | + >>> print(potmsgset.context) |
295 | None |
296 | |
297 | The method getPOTMsgSetByMsgIDText returns a message with empty context |
298 | if empty context is specified, and not the message with None context. |
299 | |
300 | >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'bar', context=u'') |
301 | - >>> print potmsgset.singular_text |
302 | + >>> print(potmsgset.singular_text) |
303 | bar |
304 | >>> print(potmsgset.context) |
305 | <BLANKLINE> |
306 | diff --git a/lib/lp/translations/utilities/doc/kde-po-file-format.txt b/lib/lp/translations/utilities/doc/kde-po-file-format.txt |
307 | index d7311b7..bb7a636 100644 |
308 | --- a/lib/lp/translations/utilities/doc/kde-po-file-format.txt |
309 | +++ b/lib/lp/translations/utilities/doc/kde-po-file-format.txt |
310 | @@ -64,10 +64,10 @@ Importing this file works, but the format is set to Gettext PO. |
311 | |
312 | >>> entry = import_pofile_or_potemplate(non_kde_template, carlos, |
313 | ... potemplate=firefox_potemplate) |
314 | - >>> print entry.status.name |
315 | + >>> print(entry.status.name) |
316 | IMPORTED |
317 | >>> flush_database_caches() |
318 | - >>> print entry.format.title |
319 | + >>> print(entry.format.title) |
320 | PO format |
321 | |
322 | == Plural forms support == |
323 | @@ -118,10 +118,10 @@ to KDE PO format. |
324 | |
325 | >>> entry = import_pofile_or_potemplate(plural_forms_template, carlos, |
326 | ... potemplate=firefox_potemplate) |
327 | - >>> print entry.status.name |
328 | + >>> print(entry.status.name) |
329 | IMPORTED |
330 | >>> flush_database_caches() |
331 | - >>> print entry.format.title |
332 | + >>> print(entry.format.title) |
333 | KDE PO format |
334 | |
335 | Messages which are preceded with just '_n:' and no space after it are |
336 | @@ -129,10 +129,10 @@ not considered plural forms messages. |
337 | |
338 | >>> potmsgset = firefox_potemplate.getPOTMsgSetByMsgIDText( |
339 | ... u'_n:bar\nbars') |
340 | - >>> print potmsgset.singular_text |
341 | + >>> print(potmsgset.singular_text) |
342 | _n:bar |
343 | bars |
344 | - >>> print potmsgset.plural_text |
345 | + >>> print(potmsgset.plural_text) |
346 | None |
347 | |
348 | Proper format in messages is to use '_n: ' and separate singular and |
349 | @@ -140,9 +140,9 @@ plural with a newline. |
350 | |
351 | >>> potmsgset = firefox_potemplate.getPOTMsgSetByMsgIDText( |
352 | ... u'%d foo', plural_text=u'%d foos') |
353 | - >>> print potmsgset.singular_text |
354 | + >>> print(potmsgset.singular_text) |
355 | %d foo |
356 | - >>> print potmsgset.plural_text |
357 | + >>> print(potmsgset.plural_text) |
358 | %d foos |
359 | |
360 | To get a non-plural message, we can either not specify plural_text or |
361 | @@ -150,9 +150,9 @@ set it as None: |
362 | |
363 | >>> potmsgset = firefox_potemplate.getPOTMsgSetByMsgIDText( |
364 | ... u'%d foo', plural_text=None) |
365 | - >>> print potmsgset.singular_text |
366 | + >>> print(potmsgset.singular_text) |
367 | %d foo |
368 | - >>> print potmsgset.plural_text |
369 | + >>> print(potmsgset.plural_text) |
370 | None |
371 | |
372 | For translations, a specially formatted msgstr is used to hold all plural |
373 | @@ -201,10 +201,10 @@ format support. |
374 | >>> entry = import_pofile_or_potemplate(firefox_serbian_pofile_contents, |
375 | ... carlos, |
376 | ... pofile=firefox_serbian_pofile) |
377 | - >>> print entry.status.name |
378 | + >>> print(entry.status.name) |
379 | IMPORTED |
380 | >>> flush_database_caches() |
381 | - >>> print entry.format.title |
382 | + >>> print(entry.format.title) |
383 | KDE PO format |
384 | |
385 | Non-KDE style messages get their translations in the usual way. |
386 | @@ -256,8 +256,8 @@ Make sure all the date constants are replaced with real values in database: |
387 | |
388 | Template export turns it back into a KDE-style PO file: |
389 | |
390 | - >>> print export_with_format( |
391 | - ... firefox_potemplate, TranslationFileFormat.KDEPO) |
392 | + >>> print(export_with_format( |
393 | + ... firefox_potemplate, TranslationFileFormat.KDEPO)) |
394 | #, fuzzy |
395 | msgid "" |
396 | msgstr "" |
397 | @@ -307,8 +307,8 @@ But, we can also export it as a regular gettext PO file. This format |
398 | does not support messages that are identical in all but the plural, so |
399 | those are stripped out. |
400 | |
401 | - >>> print export_with_format(firefox_potemplate, |
402 | - ... TranslationFileFormat.PO) |
403 | + >>> print(export_with_format(firefox_potemplate, |
404 | + ... TranslationFileFormat.PO)) |
405 | #, fuzzy |
406 | msgid "" |
407 | msgstr "" |
408 | @@ -343,7 +343,7 @@ those are stripped out. |
409 | |
410 | Exporting a translation is possible in a very similar way. |
411 | |
412 | - >>> print firefox_serbian_pofile.export().decode('utf8') |
413 | + >>> print(firefox_serbian_pofile.export().decode('utf8')) |
414 | msgid "" |
415 | msgstr "" |
416 | ... |
417 | @@ -424,26 +424,26 @@ Importing this template works and the format is recognized as a KDE PO format. |
418 | |
419 | >>> entry = import_pofile_or_potemplate(kde_context_template, carlos, |
420 | ... potemplate=firefox_potemplate) |
421 | - >>> print entry.status.name |
422 | + >>> print(entry.status.name) |
423 | IMPORTED |
424 | >>> flush_database_caches() |
425 | - >>> print entry.format.title |
426 | + >>> print(entry.format.title) |
427 | KDE PO format |
428 | |
429 | Message with context is properly split into msgid and context fields. |
430 | |
431 | >>> potmsgset = firefox_potemplate.getPOTMsgSetByMsgIDText( |
432 | ... u'Message', context='Context') |
433 | - >>> print potmsgset.singular_text |
434 | + >>> print(potmsgset.singular_text) |
435 | Message |
436 | - >>> print potmsgset.context |
437 | + >>> print(potmsgset.context) |
438 | Context |
439 | |
440 | If we ask for a message without specifying context, we get no results: |
441 | |
442 | >>> potmsgset = firefox_potemplate.getPOTMsgSetByMsgIDText( |
443 | ... u'Message') |
444 | - >>> print potmsgset |
445 | + >>> print(potmsgset) |
446 | None |
447 | |
448 | We can also import a translated file with message contexts: |
449 | @@ -463,10 +463,10 @@ We can also import a translated file with message contexts: |
450 | ... ''' % ISO_FORMATTED_DATE).encode('UTF-8') |
451 | >>> entry = import_pofile_or_potemplate(kde_context_translation, carlos, |
452 | ... pofile=firefox_serbian_pofile) |
453 | - >>> print entry.status.name |
454 | + >>> print(entry.status.name) |
455 | IMPORTED |
456 | >>> flush_database_caches() |
457 | - >>> print entry.format.title |
458 | + >>> print(entry.format.title) |
459 | KDE PO format |
460 | |
461 | |
462 | @@ -497,8 +497,8 @@ other message and its translation: |
463 | |
464 | Exporting a PO template as a KDE PO file joins the context back together: |
465 | |
466 | - >>> print export_with_format(firefox_potemplate, |
467 | - ... TranslationFileFormat.KDEPO) |
468 | + >>> print(export_with_format(firefox_potemplate, |
469 | + ... TranslationFileFormat.KDEPO)) |
470 | #, fuzzy |
471 | msgid "" |
472 | msgstr "" |
473 | @@ -520,7 +520,7 @@ Exporting a PO template as a KDE PO file joins the context back together: |
474 | |
475 | And the same happens with a translation: |
476 | |
477 | - >>> print firefox_serbian_pofile.export().decode('utf8') |
478 | + >>> print(firefox_serbian_pofile.export().decode('utf8')) |
479 | msgid "" |
480 | msgstr "" |
481 | ... |
482 | diff --git a/lib/lp/translations/utilities/doc/pluralforms.txt b/lib/lp/translations/utilities/doc/pluralforms.txt |
483 | index e5f6bf5..5b6ba20 100644 |
484 | --- a/lib/lp/translations/utilities/doc/pluralforms.txt |
485 | +++ b/lib/lp/translations/utilities/doc/pluralforms.txt |
486 | @@ -28,7 +28,7 @@ It's also known that Serbian has 3 plural forms. |
487 | ... expression, pluralforms_count) |
488 | |
489 | >>> for form_dict in friendly_plural_forms: |
490 | - ... print form_dict['form'], ":", form_dict['examples'] |
491 | + ... print(form_dict['form'], ":", form_dict['examples']) |
492 | 0 : [1, 21, 31, 41, 51, 61] |
493 | 1 : [2, 3, 4, 22, 23, 24] |
494 | 2 : [0, 5, 6, 7, 8, 9] |
495 | diff --git a/lib/lp/translations/utilities/doc/templatenames.txt b/lib/lp/translations/utilities/doc/templatenames.txt |
496 | index cc69bd9..55bef11 100644 |
497 | --- a/lib/lp/translations/utilities/doc/templatenames.txt |
498 | +++ b/lib/lp/translations/utilities/doc/templatenames.txt |
499 | @@ -9,18 +9,18 @@ also know how to detect xpi templates and generic template file names and |
500 | derive translation domains from directory names, if possible. |
501 | |
502 | >>> from lp.translations.utilities.template import make_domain |
503 | - >>> print make_domain("po/my_domain.pot") |
504 | + >>> print(make_domain("po/my_domain.pot")) |
505 | my_domain |
506 | - >>> print make_domain("po/my_domain/messages.pot") |
507 | + >>> print(make_domain("po/my_domain/messages.pot")) |
508 | my_domain |
509 | - >>> print make_domain("my_module/po/messages.pot") |
510 | + >>> print(make_domain("my_module/po/messages.pot")) |
511 | my_module |
512 | - >>> print make_domain("my_domain/en-US.xpi") |
513 | + >>> print(make_domain("my_domain/en-US.xpi")) |
514 | my_domain |
515 | |
516 | If a template path is generic, no translation domain can be derived. |
517 | |
518 | - >>> print make_domain("po/messages.pot") |
519 | + >>> print(make_domain("po/messages.pot")) |
520 | <BLANKLINE> |
521 | |
522 | The conversion from domain to template name replaces underscores (_) with |
523 | @@ -28,15 +28,15 @@ dashes (-) and makes all characters lower case. Invalid characters are |
524 | removed. |
525 | |
526 | >>> from lp.translations.utilities.template import make_name |
527 | - >>> print make_name("My_Domain") |
528 | + >>> print(make_name("My_Domain")) |
529 | my-domain |
530 | - >>> print make_name("my #domain@home") |
531 | + >>> print(make_name("my #domain@home")) |
532 | mydomainhome |
533 | |
534 | Finally, the convenience function make_name_from_path chains the first two |
535 | methods. |
536 | |
537 | >>> from lp.translations.utilities.template import make_name_from_path |
538 | - >>> print make_name_from_path("po/MyDomain/messages.pot") |
539 | + >>> print(make_name_from_path("po/MyDomain/messages.pot")) |
540 | mydomain |
541 | |
542 | diff --git a/lib/lp/translations/utilities/tests/test_system_documentation.py b/lib/lp/translations/utilities/tests/test_system_documentation.py |
543 | index a65ee84..8f1af4f 100644 |
544 | --- a/lib/lp/translations/utilities/tests/test_system_documentation.py |
545 | +++ b/lib/lp/translations/utilities/tests/test_system_documentation.py |
546 | @@ -25,7 +25,8 @@ here = os.path.dirname(os.path.realpath(__file__)) |
547 | # Files that have special needs can construct their own suite |
548 | special = { |
549 | 'gettext_po_parser.txt': LayeredDocFileSuite( |
550 | - '../doc/gettext_po_parser.txt', setUp=setGlobs, stdout_logging=False) |
551 | + '../doc/gettext_po_parser.txt', |
552 | + setUp=lambda test: setGlobs(test, future=True), stdout_logging=False) |
553 | } |
554 | |
555 | |
556 | @@ -58,7 +59,8 @@ def test_suite(): |
557 | for filename in filenames: |
558 | path = os.path.join('../doc/', filename) |
559 | one_test = LayeredDocFileSuite( |
560 | - path, setUp=setUp, tearDown=tearDown, |
561 | + path, |
562 | + setUp=lambda test: setUp(test, future=True), tearDown=tearDown, |
563 | layer=LaunchpadFunctionalLayer, |
564 | stdout_logging_level=logging.WARNING |
565 | ) |
Self-approving (trivial and mechanical).