]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-130655: gettext: Add fallback testcase (GH-136857) (#136862)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 20 Jul 2025 12:32:58 +0000 (14:32 +0200)
committerGitHub <noreply@github.com>
Sun, 20 Jul 2025 12:32:58 +0000 (12:32 +0000)
gh-130655: gettext: Add fallback testcase (GH-136857)
(cherry picked from commit c6e6fe92cd8b90d546652764e3eaf1631da16f8f)

Co-authored-by: Dominic H <dom@dominic.sk>
Lib/test/test_gettext.py

index 33b7d75e3ff203db0c8a37e725c46399050baa6c..9ad37909a8ec4e015b0c6e6c98400aa3d001be79 100644 (file)
@@ -937,6 +937,13 @@ class MiscTestCase(unittest.TestCase):
         ensure_lazy_imports("gettext", {"re", "warnings", "locale"})
 
 
+class TranslationFallbackTestCase(unittest.TestCase):
+    def test_translation_fallback(self):
+        with os_helper.temp_cwd() as tempdir:
+            t = gettext.translation('gettext', localedir=tempdir, fallback=True)
+            self.assertIsInstance(t, gettext.NullTranslations)
+
+
 if __name__ == '__main__':
     unittest.main()