Mercurial > babel > mirror
comparison babel/messages/tests/pofile.py @ 585:5c9dba5dd311 trunk
handle irregular multi-line msgstr (no "" as first line) gracefully (#171)
author | fschwarz |
---|---|
date | Sat, 04 Aug 2012 23:10:41 +0000 |
parents | 3fd7fb953633 |
children | d1618dfaf114 |
comparison
equal
deleted
inserted
replaced
584:e0454b9c125c | 585:5c9dba5dd311 |
---|---|
537 | 537 |
538 def test_unescape_of_quoted_newline(self): | 538 def test_unescape_of_quoted_newline(self): |
539 # regression test for #198 | 539 # regression test for #198 |
540 self.assertEqual(r'\n', pofile.unescape(r'"\\n"')) | 540 self.assertEqual(r'\n', pofile.unescape(r'"\\n"')) |
541 | 541 |
542 def test_denormalize_on_msgstr_without_empty_first_line(self): | |
543 # handle irregular multi-line msgstr (no "" as first line) | |
544 # gracefully (#171) | |
545 msgstr = '"multi-line\\n"\n" translation"' | |
546 expected_denormalized = u'multi-line\n translation' | |
547 | |
548 self.assertEqual(expected_denormalized, pofile.denormalize(msgstr)) | |
549 self.assertEqual(expected_denormalized, | |
550 pofile.denormalize('""\n' + msgstr)) | |
551 | |
542 | 552 |
543 def suite(): | 553 def suite(): |
544 suite = unittest.TestSuite() | 554 suite = unittest.TestSuite() |
545 suite.addTest(doctest.DocTestSuite(pofile, optionflags=doctest.ELLIPSIS)) | 555 suite.addTest(doctest.DocTestSuite(pofile, optionflags=doctest.ELLIPSIS)) |
546 suite.addTest(unittest.makeSuite(ReadPoTestCase)) | 556 suite.addTest(unittest.makeSuite(ReadPoTestCase)) |