MCPcopy Create free account
hub / github.com/EasyIME/PIME / test_gettext

Method test_gettext

python/python3/tornado/test/locale_test.py:60–77  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

58 shutil.rmtree(tmpdir)
59
60 def test_gettext(self):
61 tornado.locale.load_gettext_translations(
62 os.path.join(os.path.dirname(__file__), "gettext_translations"),
63 "tornado_test",
64 )
65 locale = tornado.locale.get("fr_FR")
66 self.assertTrue(isinstance(locale, tornado.locale.GettextLocale))
67 self.assertEqual(locale.translate("school"), u"\u00e9cole")
68 self.assertEqual(locale.pgettext("law", "right"), u"le droit")
69 self.assertEqual(locale.pgettext("good", "right"), u"le bien")
70 self.assertEqual(
71 locale.pgettext("organization", "club", "clubs", 1), u"le club"
72 )
73 self.assertEqual(
74 locale.pgettext("organization", "club", "clubs", 2), u"les clubs"
75 )
76 self.assertEqual(locale.pgettext("stick", "club", "clubs", 1), u"le b\xe2ton")
77 self.assertEqual(locale.pgettext("stick", "club", "clubs", 2), u"les b\xe2tons")
78
79
80class LocaleDataTest(unittest.TestCase):

Callers

nothing calls this directly

Calls 4

joinMethod · 0.80
getMethod · 0.45
translateMethod · 0.45
pgettextMethod · 0.45

Tested by

no test coverage detected