summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Krier <ced@b2ck.com>2018-08-19 18:03:02 +0200
committerCédric Krier <ced@b2ck.com>2018-08-19 18:03:02 +0200
commit85f6587c8556592e969b23a92f7432d24d464532 (patch)
tree1a2107c382348eaab8046db2e5c491dbdd572e28
parent41e8169c63ac6b6ec673c74a9e1f7ebaa8c6be87 (diff)
downloadbabel-85f6587c8556592e969b23a92f7432d24d464532.tar.gz
Test empty translation uses fallback
-rw-r--r--tests/messages/test_mofile.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/messages/test_mofile.py b/tests/messages/test_mofile.py
index 5fedc60..66c41d9 100644
--- a/tests/messages/test_mofile.py
+++ b/tests/messages/test_mofile.py
@@ -71,3 +71,26 @@ class WriteMoTestCase(unittest.TestCase):
catalog2.add(('Fuzz', 'Fuzzes'), ('', '', ''))
buf = BytesIO()
mofile.write_mo(buf, catalog2)
+
+ def test_empty_translation_with_fallback(self):
+ catalog1 = Catalog(locale='fr_FR')
+ catalog1.add(u'', '''\
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n''')
+ catalog1.add(u'Fuzz', '')
+ buf1 = BytesIO()
+ mofile.write_mo(buf1, catalog1)
+ buf1.seek(0)
+ catalog2 = Catalog(locale='fr')
+ catalog2.add(u'', '''\
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n''')
+ catalog2.add(u'Fuzz', 'Flou')
+ buf2 = BytesIO()
+ mofile.write_mo(buf2, catalog2)
+ buf2.seek(0)
+
+ translations = Translations(fp=buf1)
+ translations.add_fallback(Translations(fp=buf2))
+
+ self.assertEqual(u'Flou', translations.ugettext('Fuzz'))