예제 #1
0
    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')
예제 #2
0
    def test_FloatField_validates_float_values_correctly(self):
        field = FloatField()

        try:
            field.validate(3.1415927)
        except ValidationError:
            self.fail('FloatField.validate() raised ValidationError unexpectedly')
예제 #3
0
    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')
예제 #4
0
    def test_FloatField_validates_float_values_correctly(self):
        field = FloatField()

        try:
            field.validate(3.1415927)
        except ValidationError:
            self.fail(
                'FloatField.validate() raised ValidationError unexpectedly')
예제 #5
0
 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)
예제 #6
0
 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)