Exemple #1
0
 def test_nonpositive_raises_if_int_value_is_greater_than_zero(self):
     n = ZeroNumber(inonpositive=5)
     with self.assertRaises(ValidationException) as context:
         n.validate()
     self.assertEqual(len(context.exception.keypath_messages), 1)
     self.assertEqual(context.exception.keypath_messages['inonpositive'],
                      "value is not nonpositive")
 def test_positive_raises_if_int_value_is_equal_to_zero(self):
     n = ZeroNumber(ipositive=0)
     with self.assertRaises(ValidationException) as context:
         n.validate()
     self.assertEqual(len(context.exception.keypath_messages), 1)
     self.assertEqual(context.exception.keypath_messages['ipositive'],
                      "value is not positive")
 def test_positive_raises_if_float_value_is_less_than_zero(self):
     n = ZeroNumber(fpositive=-5.5)
     with self.assertRaises(ValidationException) as context:
         n.validate()
     self.assertEqual(len(context.exception.keypath_messages), 1)
     self.assertEqual(context.exception.keypath_messages['fpositive'],
                      "value is not positive")
Exemple #4
0
 def test_nonpositive_doesnt_raise_if_float_value_is_less_than_zero(self):
     n = ZeroNumber(fnonpositive=-5.5)
     n.validate()
Exemple #5
0
 def test_nonpositive_doesnt_raise_if_int_value_is_equal_to_zero(self):
     n = ZeroNumber(inonpositive=0)
     n.validate()
 def test_positive_doesnt_raise_if_float_value_is_greater_than_zero(self):
     n = ZeroNumber(fpositive=5.5)
     n.validate()
 def test_nonnegative_doesnt_raise_if_int_value_is_greater_than_zero(self):
     n = ZeroNumber(inonnegative=5)
     n.validate()
 def test_nonnegative_doesnt_raise_if_float_value_is_equal_to_zero(self):
     n = ZeroNumber(fnonnegative=0)
     n.validate()
 def test_negative_doesnt_raise_if_int_value_is_less_than_zero(self):
     n = ZeroNumber(inegative=-5)
     n.validate()