Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")