Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaa91a11

Browse files
[3.12]gh-130655: Increase test coverage of gettext._expand_lang() (GH-130656) (GH-130672)
(cherry picked from commit24c52cb)Co-authored-by: Tomas R <tomas.roun8@gmail.com>
1 parent500ea3b commitaa91a11

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

‎Lib/test/test_gettext.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
importbase64
33
importgettext
44
importunittest
5+
importunittest.mock
56
fromfunctoolsimportpartial
67

78
fromtestimportsupport
@@ -739,6 +740,32 @@ def test_cache(self):
739740
self.assertEqual(t.__class__,DummyGNUTranslations)
740741

741742

743+
classExpandLangTestCase(unittest.TestCase):
744+
deftest_expand_lang(self):
745+
# Test all combinations of territory, charset and
746+
# modifier (locale extension)
747+
locales= {
748+
'cs': ['cs'],
749+
'cs_CZ': ['cs_CZ','cs'],
750+
'cs.ISO8859-2': ['cs.ISO8859-2','cs'],
751+
'cs@euro': ['cs@euro','cs'],
752+
'cs_CZ.ISO8859-2': ['cs_CZ.ISO8859-2','cs_CZ','cs.ISO8859-2',
753+
'cs'],
754+
'cs_CZ@euro': ['cs_CZ@euro','cs@euro','cs_CZ','cs'],
755+
'cs.ISO8859-2@euro': ['cs.ISO8859-2@euro','cs@euro',
756+
'cs.ISO8859-2','cs'],
757+
'cs_CZ.ISO8859-2@euro': ['cs_CZ.ISO8859-2@euro','cs_CZ@euro',
758+
'cs.ISO8859-2@euro','cs@euro',
759+
'cs_CZ.ISO8859-2','cs_CZ',
760+
'cs.ISO8859-2','cs'],
761+
}
762+
forlocale,expandedinlocales.items():
763+
withself.subTest(locale=locale):
764+
withunittest.mock.patch("locale.normalize",
765+
return_value=locale):
766+
self.assertEqual(gettext._expand_lang(locale),expanded)
767+
768+
742769
classMiscTestCase(unittest.TestCase):
743770
deftest__all__(self):
744771
support.check__all__(self,gettext,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp