Ejemplo n.º 1
0
 def test_sanitize_language_code(self):
     """Check that slightly malformed language codes can be corrected."""
     for lang in 'pt', 'PT':
         assert i18n.sanitize_language_code(lang) == 'pt'
     for lang in 'pt-br', 'pt_br', 'pt_BR':
         assert i18n.sanitize_language_code(lang) == 'pt_BR'
     for lang in 'foo', 'bar', 'foo-bar':
         assert i18n.sanitize_language_code(lang) == lang
Ejemplo n.º 2
0
def test_sanitize_language_code():
    """Check that slightly malformed language codes can be corrected."""
    for lang in 'pt', 'PT':
        assert i18n.sanitize_language_code(lang) == 'pt'
    for lang in 'pt-br', 'pt_br', 'pt_BR':
        assert i18n.sanitize_language_code(lang) == 'pt_BR'
    for lang in 'foo', 'bar', 'foo-bar':
        assert i18n.sanitize_language_code(lang) == lang
Ejemplo n.º 3
0
 def test_sanitize_language_code_numeric_variant(self):
     assert i18n.sanitize_language_code('de-CH-1996') == 'de_CH'
Ejemplo n.º 4
0
 def test_sanitize_language_code_numeric(self):
     assert i18n.sanitize_language_code('es-419') == 'es_419'
Ejemplo n.º 5
0
 def test_sanitize_language_code_territory_script_variant(self):
     assert i18n.sanitize_language_code('zh_Hans_CN') == 'zh_CN'
Ejemplo n.º 6
0
 def test_sanitize_language_code_charset_and_modifier(self):
     assert i18n.sanitize_language_code('de_DE.iso885915@euro') == 'de_DE'
Ejemplo n.º 7
0
 def test_sanitize_language_code_modifier(self):
     assert i18n.sanitize_language_code('it_IT@euro') == 'it_IT'
Ejemplo n.º 8
0
 def test_sanitize_language_code_charset(self):
     assert i18n.sanitize_language_code('en_US.UTF-8') == 'en_US'
Ejemplo n.º 9
0
 def test_sanitize_language_code_numeric_variant(self):
     assert i18n.sanitize_language_code('de-CH-1996') == 'de_CH'
Ejemplo n.º 10
0
 def test_sanitize_language_code_numeric(self):
     assert i18n.sanitize_language_code('es-419') == 'es_419'
Ejemplo n.º 11
0
 def test_sanitize_language_code_territory_script_variant(self):
     assert i18n.sanitize_language_code('zh_Hans_CN') == 'zh_CN'
Ejemplo n.º 12
0
 def test_sanitize_language_code_charset_and_modifier(self):
     assert i18n.sanitize_language_code('de_DE.iso885915@euro') == 'de_DE'
Ejemplo n.º 13
0
 def test_sanitize_language_code_modifier(self):
     assert i18n.sanitize_language_code('it_IT@euro') == 'it_IT'
Ejemplo n.º 14
0
 def test_sanitize_language_code_charset(self):
     assert i18n.sanitize_language_code('en_US.UTF-8') == 'en_US'