Mercurial > babel > old > mirror
comparison babel/messages/tests/pofile.py @ 251:3b9d993b7aa3
added test cases for correct po/mofile sorting, following up r264
author | pjenvey |
---|---|
date | Mon, 13 Aug 2007 04:16:16 +0000 |
parents | aaf36f409166 |
children | 62d4f85d33ea |
comparison
equal
deleted
inserted
replaced
250:194f927d8c5a | 251:3b9d993b7aa3 |
---|---|
283 msgid "foo" | 283 msgid "foo" |
284 msgid_plural "foos" | 284 msgid_plural "foos" |
285 msgstr[0] "Voh" | 285 msgstr[0] "Voh" |
286 msgstr[1] "Voeh"''', buf.getvalue().strip()) | 286 msgstr[1] "Voeh"''', buf.getvalue().strip()) |
287 | 287 |
288 def test_sorted_po(self): | |
289 catalog = Catalog() | |
290 catalog.add(u'bar', locations=[('utils.py', 3)], | |
291 user_comments=['Comment About `bar` with', | |
292 'multiple lines.']) | |
293 catalog.add((u'foo', u'foos'), (u'Voh', u'Voeh'), | |
294 locations=[('main.py', 1)]) | |
295 buf = StringIO() | |
296 pofile.write_po(buf, catalog, sort_output=True) | |
297 value = buf.getvalue().strip() | |
298 assert '''\ | |
299 # Comment About `bar` with | |
300 # multiple lines. | |
301 #: utils.py:3 | |
302 msgid "bar" | |
303 msgstr "" | |
304 | |
305 #: main.py:1 | |
306 msgid "foo" | |
307 msgid_plural "foos" | |
308 msgstr[0] "Voh" | |
309 msgstr[1] "Voeh"''' in value | |
310 assert value.find('msgid ""') < value.find('msgid "bar"') < value.find('msgid "foo"') | |
288 | 311 |
289 def suite(): | 312 def suite(): |
290 suite = unittest.TestSuite() | 313 suite = unittest.TestSuite() |
291 suite.addTest(doctest.DocTestSuite(pofile)) | 314 suite.addTest(doctest.DocTestSuite(pofile)) |
292 suite.addTest(unittest.makeSuite(ReadPoTestCase)) | 315 suite.addTest(unittest.makeSuite(ReadPoTestCase)) |