本文整理汇总了Python中validator.Validator.language_validator方法的典型用法代码示例。如果您正苦于以下问题:Python Validator.language_validator方法的具体用法?Python Validator.language_validator怎么用?Python Validator.language_validator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类validator.Validator
的用法示例。
在下文中一共展示了Validator.language_validator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ValidatorTests
# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import language_validator [as 别名]
class ValidatorTests(unittest.TestCase):
def setUp(self):
self.validator = Validator()
def test_language_validator_sanity(self):
self.assertTrue(self.validator.language_validator("CSS"))
def test_language_validator_sanity_test_invalid_input(self):
self.assertFalse(self.validator.language_validator("abcd454"))
expected = {'error_code': 1, 'error': "invalid language"}
extracted = self.validator.get_error()
self.assertEqual(expected, extracted)
def test_creation_date_sanity(self):
self.assertTrue(self.validator.creation_date_validator("past-week"))
def test_creation_date_sanity_test_invalid_input(self):
self.assertFalse(self.validator.creation_date_validator("abcd454"))
expected = {'error_code': 2, 'error': "invalid creation date"}
extracted = self.validator.get_error()
self.assertEqual(expected, extracted)