MCPcopy Create free account
hub / github.com/bleachbit/bleachbit / test_locale_regex

Method test_locale_regex

tests/TestUnix.py:544–560  ·  view source on GitHub ↗

Unit test for locale_to_language()

(self)

Source from the content-addressed store, hash-verified

542 self.assertIn('en_AU', purgeable_locales)
543
544 def test_locale_regex(self):
545 """Unit test for locale_to_language()"""
546 tests = {'en': 'en',
547 'en_US': 'en',
548 'en_US@piglatin': 'en',
549 'en_US.utf8': 'en',
550 'ko_KR.eucKR': 'ko',
551 'pl.ISO8859-2': 'pl',
552 'zh_TW.Big5': 'zh'}
553 regex = re.compile('^' + Locales.localepattern + '$')
554 for locale, tlc in tests.items():
555 m = regex.match(locale)
556 self.assertIsNotNone(m, 'expected positive match for ' + locale)
557 self.assertEqual(m.group("locale"), tlc)
558 for test in ['default', 'C', 'English', 'ru_RU.txt', 'ru.txt']:
559 self.assertIsNone(regex.match(
560 test), 'expected negative match for ' + test)
561
562 @common.skipIfWindows
563 def test_localization_paths(self):

Callers

nothing calls this directly

Calls 1

matchMethod · 0.80

Tested by

no test coverage detected