diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2013-07-06 22:18:47 +0200 |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2013-07-06 22:18:47 +0200 |
commit | f4f8a4b179fdfebd032aa910bba82c5c5746d0f7 (patch) | |
tree | c5562a6f859900c3502d70104cea288e9b41ff93 /tests | |
parent | 0fc334840f9ed05fcc27787e0e007c26f54f6c1d (diff) | |
download | babel-f4f8a4b179fdfebd032aa910bba82c5c5746d0f7.tar.gz |
More gettext fixes
Diffstat (limited to 'tests')
-rw-r--r-- | tests/messages/test_mofile.py | 4 | ||||
-rw-r--r-- | tests/messages/test_pofile.py | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/tests/messages/test_mofile.py b/tests/messages/test_mofile.py index c381cec..200704e 100644 --- a/tests/messages/test_mofile.py +++ b/tests/messages/test_mofile.py @@ -11,12 +11,12 @@ # individuals. For the exact contribution history, see the revision # history and logs, available at http://babel.edgewall.org/log/. -import gettext import os import unittest from babel.messages import mofile, Catalog from babel._compat import BytesIO +from babel.util import Translations class ReadMoTestCase(unittest.TestCase): @@ -57,7 +57,7 @@ class WriteMoTestCase(unittest.TestCase): buf = BytesIO() mofile.write_mo(buf, catalog) buf.seek(0) - translations = gettext.GNUTranslations(fp=buf) + translations = Translations(fp=buf) self.assertEqual(u'Voh', translations.ugettext('foo')) assert isinstance(translations.ugettext('foo'), unicode) self.assertEqual(u'Es gibt', translations.ungettext('There is', 'There are', 1)) diff --git a/tests/messages/test_pofile.py b/tests/messages/test_pofile.py index 59b8a24..3bb0557 100644 --- a/tests/messages/test_pofile.py +++ b/tests/messages/test_pofile.py @@ -36,7 +36,7 @@ msgstr "Voh"''') self.assertEqual('mydomain', catalog.domain) def test_applies_specified_encoding_during_read(self): - buf = StringIO(u''' + buf = BytesIO(u''' msgid "" msgstr "" "Project-Id-Version: 3.15\\n" @@ -165,7 +165,7 @@ msgstr "Bahr" self.assertEqual(0, len(catalog.obsolete)) def test_with_context(self): - buf = StringIO(r'''# Some string in the menu + buf = BytesIO(b'''# Some string in the menu #: main.py:1 msgctxt "Menu" msgid "foo" @@ -191,7 +191,7 @@ msgstr "Bahr" out_buf.getvalue() def test_with_context_two(self): - buf = StringIO(r'''msgctxt "Menu" + buf = BytesIO(b'''msgctxt "Menu" msgid "foo" msgstr "Voh" @@ -265,7 +265,7 @@ class WritePoTestCase(unittest.TestCase): catalog.add(u'foo', locations=[('utils.py', 3)]) buf = BytesIO() pofile.write_po(buf, catalog, omit_header=True) - self.assertEqual('''#: main.py:1 utils.py:3 + self.assertEqual(b'''#: main.py:1 utils.py:3 msgid "foo" msgstr ""''', buf.getvalue().strip()) @@ -275,7 +275,7 @@ msgstr ""''', buf.getvalue().strip()) buf = BytesIO() pofile.write_po(buf, catalog, omit_header=False) po_file = buf.getvalue().strip() - assert r'"Content-Type: text/plain; charset=iso-8859-1\n"' in po_file + assert b'"Content-Type: text/plain; charset=iso-8859-1\\n"' in po_file assert u'msgstr "äöü"'.encode('iso-8859-1') in po_file def test_duplicate_comments(self): @@ -340,7 +340,7 @@ msgstr ""''', buf.getvalue().strip()) # AReallyReallyLongNameForAProject project. # FIRST AUTHOR <EMAIL@ADDRESS>, 2007. # -#, fuzzy''', '\n'.join(buf.getvalue().splitlines()[:7])) +#, fuzzy''', b'\n'.join(buf.getvalue().splitlines()[:7])) def test_wrap_locations_with_hyphens(self): catalog = Catalog() @@ -511,7 +511,7 @@ msgid "foo" msgid_plural "foos" msgstr[0] "Voh" msgstr[1] "Voeh"''' in value - assert value.find('msgid ""') < value.find('msgid "bar"') < value.find('msgid "foo"') + assert value.find(b'msgid ""') < value.find(b'msgid "bar"') < value.find(b'msgid "foo"') def test_silent_location_fallback(self): buf = BytesIO(b'''\ |