def test_absolute_max_valid(self): valid_text = gen_random_text(self.max_length) self.assertTrue(self.validator.is_valid(valid_text))
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))
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))
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))
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)