diff babel/messages/tests/pofile.py @ 190:5041d90edf0c trunk

Correctly write out obsolete messages spanning multiple lines. Fixes #33.
author cmlenz
date Sun, 01 Jul 2007 17:45:27 +0000
parents 8a762ce37bf7
children c171a0041ad2
line wrap: on
line diff
--- a/babel/messages/tests/pofile.py
+++ b/babel/messages/tests/pofile.py
@@ -150,7 +150,7 @@
 msgid "bar"
 msgstr ""''', buf.getvalue().strip())
 
-    def test_po_with_obsolete_messages(self):
+    def test_po_with_obsolete_message(self):
         catalog = Catalog()
         catalog.add(u'foo', u'Voh', locations=[('main.py', 1)])
         catalog.obsolete['bar'] = Message(u'bar', u'Bahr',
@@ -166,6 +166,34 @@
 #~ msgid "bar"
 #~ msgstr "Bahr"''', buf.getvalue().strip())
 
+    def test_po_with_multiline_obsolete_message(self):
+        catalog = Catalog()
+        catalog.add(u'foo', u'Voh', locations=[('main.py', 1)])
+        msgid = r"""Here's a message that covers
+multiple lines, and should still be handled
+correctly.
+"""
+        msgstr = r"""Here's a message that covers
+multiple lines, and should still be handled
+correctly.
+"""
+        catalog.obsolete[msgid] = Message(msgid, msgstr,
+                                          locations=[('utils.py', 3)])
+        buf = StringIO()
+        pofile.write_po(buf, catalog, omit_header=True)
+        self.assertEqual(r'''#: main.py:1
+msgid "foo"
+msgstr "Voh"
+
+#~ msgid ""
+#~ "Here's a message that covers\n"
+#~ "multiple lines, and should still be handled\n"
+#~ "correctly.\n"
+#~ msgstr ""
+#~ "Here's a message that covers\n"
+#~ "multiple lines, and should still be handled\n"
+#~ "correctly.\n"''', buf.getvalue().strip())
+
 
 def suite():
     suite = unittest.TestSuite()
Copyright (C) 2012-2017 Edgewall Software