コード例 #1
0
ファイル: test_structs.py プロジェクト: pushsos/aioxmpp
    def test_match_direct(self):
        self.assertEqual(
            structs.LanguageTag.fromstr("fr-CH"),
            structs.lookup_language(
                self.languages,
                list(
                    map(structs.LanguageRange.fromstr,
                        ["en", "fr-ch", "de-de"]))))

        self.assertEqual(
            structs.LanguageTag.fromstr("it"),
            structs.lookup_language(
                self.languages,
                list(map(structs.LanguageRange.fromstr, [
                    "it",
                ]))))
コード例 #2
0
ファイル: test_structs.py プロジェクト: pushsos/aioxmpp
 def test_decay_skips_extension_prefixes_properly(self):
     self.assertEqual(
         structs.LanguageTag.fromstr("de-DE"),
         structs.lookup_language(
             list(map(structs.LanguageTag.fromstr, [
                 "de-DE",
                 "de-x",
             ])), list(map(structs.LanguageRange.fromstr, [
                 "de-x-foobar",
             ]))))
コード例 #3
0
ファイル: test_structs.py プロジェクト: pushsos/aioxmpp
    def test_decay(self):
        self.assertEqual(
            structs.LanguageTag.fromstr("de-Latn-DE-1999"),
            structs.lookup_language(
                self.languages,
                list(
                    map(structs.LanguageRange.fromstr,
                        ["de-de", "en-GB", "en"]))))

        self.assertEqual(
            structs.LanguageTag.fromstr("fr-CH"),
            structs.lookup_language(
                self.languages,
                list(
                    map(structs.LanguageRange.fromstr, [
                        "fr-FR",
                        "de-DE",
                        "fr",
                    ]))))
コード例 #4
0
 def test_decay_skips_extension_prefixes_properly(self):
     self.assertEqual(
         structs.LanguageTag.fromstr("de-DE"),
         structs.lookup_language(
             list(map(structs.LanguageTag.fromstr, [
                 "de-DE",
                 "de-x",
             ])),
             list(map(structs.LanguageRange.fromstr, [
                 "de-x-foobar",
             ]))
         )
     )
コード例 #5
0
    def test_match_direct(self):
        self.assertEqual(
            structs.LanguageTag.fromstr("fr-CH"),
            structs.lookup_language(
                self.languages,
                list(map(structs.LanguageRange.fromstr, [
                    "en",
                    "fr-ch",
                    "de-de"
                ]))
            )
        )

        self.assertEqual(
            structs.LanguageTag.fromstr("it"),
            structs.lookup_language(
                self.languages,
                list(map(structs.LanguageRange.fromstr, [
                    "it",
                ]))
            )
        )
コード例 #6
0
    def test_decay(self):
        self.assertEqual(
            structs.LanguageTag.fromstr("de-Latn-DE-1999"),
            structs.lookup_language(
                self.languages,
                list(map(structs.LanguageRange.fromstr, [
                    "de-de",
                    "en-GB",
                    "en"
                ]))
            )
        )

        self.assertEqual(
            structs.LanguageTag.fromstr("fr-CH"),
            structs.lookup_language(
                self.languages,
                list(map(structs.LanguageRange.fromstr, [
                    "fr-FR",
                    "de-DE",
                    "fr",
                ]))
            )
        )