Пример #1
0
 def test_lang_good_and_bad_code(self):
     option = search.LangOption()
     self.assertRaises(ValidationError, option.validate, ['en', 'foo'])
Пример #2
0
 def test_lang_multi_list(self):
     option = search.LangOption()
     value = option.validate(['en', 'es', 'fr'])
     self.assertEqual(['en', 'es', 'fr'], value)
Пример #3
0
 def test_lang_bad_type(self):
     option = search.LangOption()
     self.assertRaises(ValidationError, option.validate, {})
Пример #4
0
 def test_lang_str(self):
     option = search.LangOption()
     value = option.validate('en')
     self.assertEqual(['en'], value)
Пример #5
0
 def test_lang_default(self):
     option = search.LangOption(default=['en'])
     value = option.validate(None)
     self.assertEqual(['en'], value)
Пример #6
0
 def test_lang_no_default_none(self):
     option = search.LangOption()
     value = option.validate(None)
     self.assertIsNone(value)
 def test_lang_missing_and_with_territory(self):
     option = search.LangOption()
     value = option.validate(['zh_CN', 'pt_BR', 'fr'])
     self.assertEqual(['fr', 'en', 'pt'], value)
 def test_lang_good_and_bad_code(self):
     option = search.LangOption()
     value = option.validate(['en', 'foo'])
     self.assertEqual(['en'], value)