def test_should_validate_range_and_strip_text(self): constraint = TextConstraint(min=10, max=20) valid_data = constraint.validate("valid_string ") self.assertEqual(valid_data, "valid_string")
def test_should_raise_exception_for_integer_below_range(self): with self.assertRaises(VdtValueTooShortError): constraint = TextConstraint(min=10, max=20) constraint.validate("small")
def test_should_raise_exception_for_integer_above_range(self): with self.assertRaises(VdtValueTooLongError): constraint = TextConstraint(min=1, max=4) constraint.validate("invalid_string")
def test_should_validate_range_and_strip_text(self): constraint = TextConstraint(min=10, max=20) valid_data = constraint.validate("valid_string ") self.assertEqual(valid_data, "valid_string")
def test_should_raise_exception_for_integer_below_range(self): with self.assertRaises(VdtValueTooShortError): constraint = TextConstraint(min=10, max=20) constraint.validate("small")
def test_should_raise_exception_for_integer_above_range(self): with self.assertRaises(VdtValueTooLongError): constraint = TextConstraint(min=1, max=4) constraint.validate("invalid_string")