diff babel/messages/tests/pofile.py @ 196:b38a6b220ea2 trunk

Fix for #35, and a minor improvement to how we parse the catalog fuzzy bit.
author cmlenz
date Tue, 03 Jul 2007 12:52:44 +0000
parents c171a0041ad2
children a0d22f2f2df0
line wrap: on
line diff
--- a/babel/messages/tests/pofile.py
+++ b/babel/messages/tests/pofile.py
@@ -22,6 +22,18 @@
 
 class ReadPoTestCase(unittest.TestCase):
 
+    def test_preserve_locale(self):
+        buf = StringIO(r'''msgid "foo"
+msgstr "Voh"''')
+        catalog = pofile.read_po(buf, locale='en_US')
+        self.assertEqual('en_US', catalog.locale)
+
+    def test_preserve_domain(self):
+        buf = StringIO(r'''msgid "foo"
+msgstr "Voh"''')
+        catalog = pofile.read_po(buf, domain='mydomain')
+        self.assertEqual('mydomain', catalog.domain)
+
     def test_read_multiline(self):
         buf = StringIO(r'''msgid ""
 "Here's some text that\n"
@@ -35,7 +47,7 @@
         self.assertEqual("Here's some text that\nincludesareallylongwordthat"
                          "mightbutshouldnt throw us into an infinite loop\n",
                          message.id)
-        
+
     def test_fuzzy_header(self):
         buf = StringIO(r'''\
 # Translations template for AReallyReallyLongNameForAProject.
@@ -49,7 +61,7 @@
         catalog = pofile.read_po(buf)
         self.assertEqual(1, len(list(catalog)))
         self.assertEqual(True, list(catalog)[0].fuzzy)
-        
+
     def test_not_fuzzy_header(self):
         buf = StringIO(r'''\
 # Translations template for AReallyReallyLongNameForAProject.
Copyright (C) 2012-2017 Edgewall Software