def test_no_shorter_language(self): urlresolvers.lang_from_accept_header('zh') == 'zh-CN' with self.settings(LANGUAGE_URL_MAP={'en-us': 'en-US'}): urlresolvers.lang_from_accept_header('zh') == 'en-US'
def check(x, y): assert urlresolvers.lang_from_accept_header(x) == y
def test_parse_accept_language(test_input, expected): expected_locales = 'ga-IE', 'zh-TW', 'zh-CN', 'en-US', 'fr' for lang in expected_locales: assert lang in settings.AMO_LANGUAGES, lang assert urlresolvers.lang_from_accept_header(test_input) == expected
def check(x, y): return eq_(urlresolvers.lang_from_accept_header(x), y)