diff options
Diffstat (limited to 'tests/i18n')
| -rw-r--r-- | tests/i18n/tests.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index c01098eab1..1de7b11b81 100644 --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -144,6 +144,18 @@ class TranslationTests(SimpleTestCase): self.assertNotEqual(s, s4) @skipUnless(six.PY2, "No more bytestring translations on PY3") + def test_bytestrings(self): + """gettext() returns a bytestring if input is bytestring.""" + + # Using repr() to check translated text and type + self.assertEqual(repr(gettext(b"Time")), repr(b"Time")) + self.assertEqual(repr(gettext("Time")), repr("Time")) + + with translation.override('de', deactivate=True): + self.assertEqual(repr(gettext(b"Time")), repr(b"Zeit")) + self.assertEqual(repr(gettext("Time")), repr(b"Zeit")) + + @skipUnless(six.PY2, "No more bytestring translations on PY3") def test_lazy_and_bytestrings(self): # On Python 2, (n)gettext_lazy should not transform a bytestring to unicode self.assertEqual(gettext_lazy(b"test").upper(), b"TEST") |
