@@ -499,7 +499,8 @@ class CharFieldTest(BaseFieldTestCase):
499499 to_representation_cases = (
500500 {'data' : {'value' : '123' }, 'return' : '123' },
501501 {'data' : {'value' : 123 }, 'return' : '123' },
502- {'data' : {'value' : 'qwe' }, 'return' : 'qwe' }
502+ {'data' : {'value' : 'qwe' }, 'return' : 'qwe' },
503+ {'data' : {'value' : None }, 'return' : None },
503504 ) # Cases, to test the performance of `.to_representation()`.
504505 to_internal_value_cases = (
505506 {'data' : {'data' : '123' }, 'return' : '123' },
@@ -560,6 +561,7 @@ class TestIntegerField(BaseFieldTestCase):
560561 {'data' : {'value' : 123 }, 'return' : 123 },
561562 {'data' : {'value' : '123' }, 'return' : 123 },
562563 {'data' : {'value' : 'qwe' }, 'exceptions' : (ValueError ,)},
564+ {'data' : {'value' : None }, 'return' : None },
563565 ) # Cases, to test the performance of `.to_representation()`.
564566 to_internal_value_cases = (
565567 {'data' : {'data' : 123 }, 'return' : 123 },
@@ -609,6 +611,7 @@ class TestFloatField(BaseFieldTestCase):
609611 {'data' : {'value' : 123 }, 'return' : 123.0 },
610612 {'data' : {'value' : '123' }, 'return' : 123.0 },
611613 {'data' : {'value' : 'qwe' }, 'exceptions' : (ValueError ,)},
614+ {'data' : {'value' : None }, 'return' : None },
612615 ) # Cases, to test the performance of `.to_representation()`.
613616 to_internal_value_cases = (
614617 {'data' : {'data' : 123 }, 'return' : 123.0 },
@@ -949,7 +952,8 @@ class TestJsonField(BaseFieldTestCase):
949952 {'data' : {'value' : {'123' : 123 }}, 'return' : '{"123": 123}' },
950953 {'data' : {'value' : {'123' : [123 , '123' ]}}, 'return' : '{"123": [123, "123"]}' },
951954 {'data' : {'value' : lambda : None }, 'exceptions' : (ValidationError ,)},
952- {'data' : {'value' : {123 : 123 }}, 'return' : '{"123": 123}' }
955+ {'data' : {'value' : {123 : 123 }}, 'return' : '{"123": 123}' },
956+ {'data' : {'value' : None }, 'return' : 'null' },
953957 ) # Cases, to test the performance of `.to_representation()`.
954958 to_internal_value_cases = (
955959 {'data' : {'data' : {}}, 'return' : {}},
@@ -998,6 +1002,7 @@ class TestDictField(BaseFieldTestCase):
9981002 {'data' : {'value' : 123 }, 'exceptions' : (AttributeError ,)},
9991003 {'data' : {'value' : lambda : None }, 'exceptions' : (AttributeError ,)},
10001004 {'data' : {'value' : {123 : 123 }}, 'return' : {'123' : 123 }},
1005+ {'data' : {'value' : None }, 'return' : None },
10011006 {'data' : {'value' : {123 : [123 ]}}, 'params' : {'child' : IntegerField ()}, 'exceptions' : (TypeError ,)}
10021007 ) # Cases, to test the performance of `.to_representation()`.
10031008 to_internal_value_cases = (
0 commit comments