示例#1
0
 def test_absolute_max_valid(self):
     valid_text = gen_random_text(self.max_length)
     self.assertTrue(self.validator.is_valid(valid_text))
示例#2
0
 def test_invalid_max(self):
     num_chars = randint(257, 999)
     valid_text = gen_random_text(num_chars)
     self.assertFalse(self.validator.is_valid(valid_text))
示例#3
0
 def test_valid(self):
     num_chars = randint(self.min_length, self.max_length)
     valid_text = gen_random_text(num_chars)
     self.assertTrue(self.validator.is_valid(valid_text))
示例#4
0
 def test_invalid_min(self):
     num_chars = randint(-999, 15)
     valid_text = gen_random_text(num_chars)
     self.assertFalse(self.validator.is_valid(valid_text))
示例#5
0
 def setUp(self) -> None:
     self.test_field = CharField()
     self.valid_char_num = randint(0, 1000)
     self.invalid_char_num = randint(1001, 2000)
     self.valid_text = gen_random_text(self.valid_char_num)
     self.invalid_text = gen_random_text(self.invalid_char_num)