def test_FloatField_validates_None_if_value_can_be_None(self): field = FloatField(can_be_none=True) try: field.validate(None) except ValidationError: self.fail('FloatField.validate() raised ValidationError unexpectedly')
def test_FloatField_validates_float_values_correctly(self): field = FloatField() try: field.validate(3.1415927) except ValidationError: self.fail('FloatField.validate() raised ValidationError unexpectedly')
def test_FloatField_validates_None_if_value_can_be_None(self): field = FloatField(can_be_none=True) try: field.validate(None) except ValidationError: self.fail( 'FloatField.validate() raised ValidationError unexpectedly')
def test_FloatField_validates_float_values_correctly(self): field = FloatField() try: field.validate(3.1415927) except ValidationError: self.fail( 'FloatField.validate() raised ValidationError unexpectedly')
def test_FloatField_validates_with_min_and_max_values(self): field = FloatField(min=41.5, max=42.5) field.validate(41.5) field.validate(42.5) self.assertRaises(ValidationError, field.validate, 41.0) self.assertRaises(ValidationError, field.validate, 43.0)