@@ -499,7 +499,8 @@ class CharFieldTest(BaseFieldTestCase):
499
499
to_representation_cases = (
500
500
{'data' : {'value' : '123' }, 'return' : '123' },
501
501
{'data' : {'value' : 123 }, 'return' : '123' },
502
- {'data' : {'value' : 'qwe' }, 'return' : 'qwe' }
502
+ {'data' : {'value' : 'qwe' }, 'return' : 'qwe' },
503
+ {'data' : {'value' : None }, 'return' : None },
503
504
) # Cases, to test the performance of `.to_representation()`.
504
505
to_internal_value_cases = (
505
506
{'data' : {'data' : '123' }, 'return' : '123' },
@@ -560,6 +561,7 @@ class TestIntegerField(BaseFieldTestCase):
560
561
{'data' : {'value' : 123 }, 'return' : 123 },
561
562
{'data' : {'value' : '123' }, 'return' : 123 },
562
563
{'data' : {'value' : 'qwe' }, 'exceptions' : (ValueError ,)},
564
+ {'data' : {'value' : None }, 'return' : None },
563
565
) # Cases, to test the performance of `.to_representation()`.
564
566
to_internal_value_cases = (
565
567
{'data' : {'data' : 123 }, 'return' : 123 },
@@ -609,6 +611,7 @@ class TestFloatField(BaseFieldTestCase):
609
611
{'data' : {'value' : 123 }, 'return' : 123.0 },
610
612
{'data' : {'value' : '123' }, 'return' : 123.0 },
611
613
{'data' : {'value' : 'qwe' }, 'exceptions' : (ValueError ,)},
614
+ {'data' : {'value' : None }, 'return' : None },
612
615
) # Cases, to test the performance of `.to_representation()`.
613
616
to_internal_value_cases = (
614
617
{'data' : {'data' : 123 }, 'return' : 123.0 },
@@ -949,7 +952,8 @@ class TestJsonField(BaseFieldTestCase):
949
952
{'data' : {'value' : {'123' : 123 }}, 'return' : '{"123": 123}' },
950
953
{'data' : {'value' : {'123' : [123 , '123' ]}}, 'return' : '{"123": [123, "123"]}' },
951
954
{'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' },
953
957
) # Cases, to test the performance of `.to_representation()`.
954
958
to_internal_value_cases = (
955
959
{'data' : {'data' : {}}, 'return' : {}},
@@ -998,6 +1002,7 @@ class TestDictField(BaseFieldTestCase):
998
1002
{'data' : {'value' : 123 }, 'exceptions' : (AttributeError ,)},
999
1003
{'data' : {'value' : lambda : None }, 'exceptions' : (AttributeError ,)},
1000
1004
{'data' : {'value' : {123 : 123 }}, 'return' : {'123' : 123 }},
1005
+ {'data' : {'value' : None }, 'return' : None },
1001
1006
{'data' : {'value' : {123 : [123 ]}}, 'params' : {'child' : IntegerField ()}, 'exceptions' : (TypeError ,)}
1002
1007
) # Cases, to test the performance of `.to_representation()`.
1003
1008
to_internal_value_cases = (
0 commit comments