Mercurial > babel > old > mirror
comparison babel/messages/tests/pofile.py @ 205:aefe4ac123a2
Minor changes to how previous msgids are processed.
author | cmlenz |
---|---|
date | Tue, 03 Jul 2007 21:19:27 +0000 |
parents | 10e8d072e2d1 |
children | aaf36f409166 |
comparison
equal
deleted
inserted
replaced
204:9181a11feb81 | 205:aefe4ac123a2 |
---|---|
248 pofile.write_po(buf, catalog, omit_header=True, ignore_obsolete=True) | 248 pofile.write_po(buf, catalog, omit_header=True, ignore_obsolete=True) |
249 self.assertEqual('''#: main.py:1 | 249 self.assertEqual('''#: main.py:1 |
250 msgid "foo" | 250 msgid "foo" |
251 msgstr "Voh"''', buf.getvalue().strip()) | 251 msgstr "Voh"''', buf.getvalue().strip()) |
252 | 252 |
253 def test_po_with_previous_msgid(self): | |
254 catalog = Catalog() | |
255 catalog.add(u'foo', u'Voh', locations=[('main.py', 1)], | |
256 previous_id=u'fo') | |
257 buf = StringIO() | |
258 pofile.write_po(buf, catalog, omit_header=True, include_previous=True) | |
259 self.assertEqual('''#: main.py:1 | |
260 #| msgid "fo" | |
261 msgid "foo" | |
262 msgstr "Voh"''', buf.getvalue().strip()) | |
263 | |
264 def test_po_with_previous_msgid_plural(self): | |
265 catalog = Catalog() | |
266 catalog.add((u'foo', u'foos'), (u'Voh', u'Voeh'), | |
267 locations=[('main.py', 1)], previous_id=(u'fo', u'fos')) | |
268 buf = StringIO() | |
269 pofile.write_po(buf, catalog, omit_header=True, include_previous=True) | |
270 self.assertEqual('''#: main.py:1 | |
271 #| msgid "fo" | |
272 #| msgid_plural "fos" | |
273 msgid "foo" | |
274 msgid_plural "foos" | |
275 msgstr[0] "Voh" | |
276 msgstr[1] "Voeh"''', buf.getvalue().strip()) | |
277 | |
253 | 278 |
254 def suite(): | 279 def suite(): |
255 suite = unittest.TestSuite() | 280 suite = unittest.TestSuite() |
256 suite.addTest(doctest.DocTestSuite(pofile)) | 281 suite.addTest(doctest.DocTestSuite(pofile)) |
257 suite.addTest(unittest.makeSuite(ReadPoTestCase)) | 282 suite.addTest(unittest.makeSuite(ReadPoTestCase)) |