Mercurial > babel > mirror
comparison babel/messages/tests/pofile.py @ 582:3fd7fb953633 trunk
fix handling of messages containing '\\n' (#171)
author | fschwarz |
---|---|
date | Fri, 03 Aug 2012 22:41:49 +0000 |
parents | e8155a73ac2e |
children | 5c9dba5dd311 |
comparison
equal
deleted
inserted
replaced
581:99706377c930 | 582:3fd7fb953633 |
---|---|
524 msgstr ""''') | 524 msgstr ""''') |
525 catalog = pofile.read_po(buf) | 525 catalog = pofile.read_po(buf) |
526 self.assertEqual(catalog['missing line number'].locations, []) | 526 self.assertEqual(catalog['missing line number'].locations, []) |
527 self.assertEqual(catalog['broken line number'].locations, []) | 527 self.assertEqual(catalog['broken line number'].locations, []) |
528 | 528 |
529 | |
530 class PofileFunctionsTestCase(unittest.TestCase): | |
531 | |
532 def test_unescape(self): | |
533 escaped = u'"Say:\\n \\"hello, world!\\"\\n"' | |
534 unescaped = u'Say:\n "hello, world!"\n' | |
535 self.assertNotEqual(unescaped, escaped) | |
536 self.assertEqual(unescaped, pofile.unescape(escaped)) | |
537 | |
538 def test_unescape_of_quoted_newline(self): | |
539 # regression test for #198 | |
540 self.assertEqual(r'\n', pofile.unescape(r'"\\n"')) | |
541 | |
542 | |
529 def suite(): | 543 def suite(): |
530 suite = unittest.TestSuite() | 544 suite = unittest.TestSuite() |
531 suite.addTest(doctest.DocTestSuite(pofile, optionflags=doctest.ELLIPSIS)) | 545 suite.addTest(doctest.DocTestSuite(pofile, optionflags=doctest.ELLIPSIS)) |
532 suite.addTest(unittest.makeSuite(ReadPoTestCase)) | 546 suite.addTest(unittest.makeSuite(ReadPoTestCase)) |
533 suite.addTest(unittest.makeSuite(WritePoTestCase)) | 547 suite.addTest(unittest.makeSuite(WritePoTestCase)) |
548 suite.addTest(unittest.makeSuite(PofileFunctionsTestCase)) | |
534 return suite | 549 return suite |
535 | 550 |
536 if __name__ == '__main__': | 551 if __name__ == '__main__': |
537 unittest.main(defaultTest='suite') | 552 unittest.main(defaultTest='suite') |