mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 20:40:14 +03:00
add tests
This commit is contained in:
parent
3b1895effd
commit
6febc177d7
|
@ -748,6 +748,15 @@ class TestIntegerField(FieldValues):
|
||||||
}
|
}
|
||||||
field = serializers.IntegerField()
|
field = serializers.IntegerField()
|
||||||
|
|
||||||
|
def test_allow_null(self):
|
||||||
|
"""
|
||||||
|
If `allow_null=True` then `None` is a valid input.
|
||||||
|
"""
|
||||||
|
field = serializers.IntegerField(allow_null=True)
|
||||||
|
output = field.run_validation(None)
|
||||||
|
assert output is None
|
||||||
|
assert field.to_representation(None) is None
|
||||||
|
|
||||||
|
|
||||||
class TestMinMaxIntegerField(FieldValues):
|
class TestMinMaxIntegerField(FieldValues):
|
||||||
"""
|
"""
|
||||||
|
@ -794,6 +803,15 @@ class TestFloatField(FieldValues):
|
||||||
}
|
}
|
||||||
field = serializers.FloatField()
|
field = serializers.FloatField()
|
||||||
|
|
||||||
|
def test_allow_null(self):
|
||||||
|
"""
|
||||||
|
If `allow_null=True` then `None` is a valid input.
|
||||||
|
"""
|
||||||
|
field = serializers.FloatField(allow_null=True)
|
||||||
|
output = field.run_validation(None)
|
||||||
|
assert output is None
|
||||||
|
assert field.to_representation(None) is None
|
||||||
|
|
||||||
|
|
||||||
class TestMinMaxFloatField(FieldValues):
|
class TestMinMaxFloatField(FieldValues):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user