def test_language_valid(self):
        self.validate("language", ["eng", "zho", "lol", "fre", "ger", "zza"])
        self.validate("language", ["deu", "fra", "msa"])
        # self.invalidate("language", ["xxx", "ROFL", "", "es", "ENG"])
        # Issue 439: Actually, allow free-text.
        self.validate("language", ["", "German", "Chinese", "Foobarlanguage"])
        mas = Massager.for_tag("language")

        # Check completion help too
        for code in ["eng", "fra", "fre", "deu", "zho"]:
            self.failUnless(code in mas.options,
                "'%s' should be in languages options" % code)
        self.failIf("" in mas.options)
예제 #2
0
    def test_language_valid(self):
        self.validate("language", ["eng", "zho", "lol", "fre", "ger", "zza"])
        self.validate("language", ["deu", "fra", "msa"])
        # self.invalidate("language", ["xxx", "ROFL", "", "es", "ENG"])
        # Issue 439: Actually, allow free-text.
        self.validate("language", ["", "German", "Chinese", "Foobarlanguage"])
        mas = Massager.for_tag("language")

        # Check completion help too
        for code in ["eng", "fra", "fre", "deu", "zho"]:
            self.failUnless(code in mas.options,
                            "'%s' should be in languages options" % code)
        self.failIf("" in mas.options)
 def equivs(self, key, equivs):
     massager = Massager.for_tag(key)
     for value, normed in equivs.items():
         self.assertEqual(normed, massager.validate(value))
         self.assertTrue(
             isinstance(massager.validate(unicode(value)), unicode))
 def invalidate(self, key, values):
     for val in values:
         self.failIf(Massager.for_tag(key).is_valid(val))
 def validate(self, key, values):
     massager = Massager.for_tag(key)
     for val in values:
         self.assertTrue(massager.is_valid(val))
         self.assertTrue(
             isinstance(massager.validate(unicode(val)), unicode))
예제 #6
0
 def equivs(self, key, equivs):
     massager = Massager.for_tag(key)
     for value, normed in equivs.items():
         self.assertEqual(normed, massager.validate(value))
         self.assertTrue(isinstance(massager.validate(str(value)), str))
예제 #7
0
 def invalidate(self, key, values):
     for val in values:
         self.failIf(Massager.for_tag(key).is_valid(val))
예제 #8
0
 def validate(self, key, values):
     massager = Massager.for_tag(key)
     for val in values:
         self.assertTrue(massager.is_valid(val))
         self.assertTrue(isinstance(massager.validate(str(val)), str))