def test_should_raise_exception_for_non_integer_value(self):
     with self.assertRaises(VdtTypeError):
         constraint = NumericConstraint(min=10, max=20)
         constraint.validate("asasd")
 def test_should_raise_exception_for_integer_below_range(self):
     with self.assertRaises(VdtValueTooSmallError):
         constraint = NumericConstraint(min=10, max=20)
         constraint.validate(1)
 def test_should_validate_range(self):
     constraint = NumericConstraint(min=10, max=20)
     valid_data = constraint.validate(15)
     self.assertEqual(valid_data, 15)
     valid_data = constraint.validate("15")
     self.assertEqual(valid_data, 15)
 def test_should_raise_exception_for_non_integer_value(self):
     with self.assertRaises(VdtTypeError):
         constraint = NumericConstraint(min=10, max=20)
         constraint.validate("asasd")
 def test_should_raise_exception_for_integer_below_range(self):
     with self.assertRaises(VdtValueTooSmallError):
         constraint = NumericConstraint(min=10, max=20)
         constraint.validate(1)
 def test_should_validate_range(self):
     constraint = NumericConstraint(min=10, max=20)
     valid_data = constraint.validate(15)
     self.assertEqual(valid_data, 15)
     valid_data = constraint.validate("15")
     self.assertEqual(valid_data, 15)