예제 #1
0
 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")
예제 #2
0
 def test_should_raise_exception_for_integer_below_range(self):
     with self.assertRaises(VdtValueTooShortError):
         constraint = TextConstraint(min=10, max=20)
         constraint.validate("small")
예제 #3
0
 def test_should_raise_exception_for_integer_above_range(self):
     with self.assertRaises(VdtValueTooLongError):
         constraint = TextConstraint(min=1, max=4)
         constraint.validate("invalid_string")
예제 #4
0
 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")
예제 #5
0
 def test_should_raise_exception_for_integer_below_range(self):
     with self.assertRaises(VdtValueTooShortError):
         constraint = TextConstraint(min=10, max=20)
         constraint.validate("small")
예제 #6
0
 def test_should_raise_exception_for_integer_above_range(self):
     with self.assertRaises(VdtValueTooLongError):
         constraint = TextConstraint(min=1, max=4)
         constraint.validate("invalid_string")