def test_validate_when_only_digits_do_nothing(self): contains_only_digits('1234567890')
def test_validate_when_value_contains_letter_do_nothing(self): with self.assertRaises(ValidationError) as context: contains_only_digits('123a') self.assertIsNotNone(context.exception)
def test_validate_when_empty_do_nothing(self): contains_only_digits('')
def test_validate_whenOnlyDigits_shouldDoNothing(self): contains_only_digits('123')
def test_validate_whenValueContainsALetter_shouldRaise(self): with self.assertRaises(ValidationError) as context: contains_only_digits('a') self.assertIsNotNone(context.exception)
def test_validate_whenValueIsEmpty_shouldDoNothing(self): contains_only_digits('')