If `allow_null=True` then '' on HTML forms is treated as None.
(self)
| 1939 | assert output == '' |
| 1940 | |
| 1941 | def test_allow_null(self): |
| 1942 | """ |
| 1943 | If `allow_null=True` then '' on HTML forms is treated as None. |
| 1944 | """ |
| 1945 | field = serializers.ChoiceField( |
| 1946 | allow_null=True, |
| 1947 | choices=[ |
| 1948 | 1, 2, 3 |
| 1949 | ] |
| 1950 | ) |
| 1951 | field.field_name = 'example' |
| 1952 | value = field.get_value(QueryDict('example=')) |
| 1953 | assert value is None |
| 1954 | output = field.run_validation(None) |
| 1955 | assert output is None |
| 1956 | |
| 1957 | def test_iter_options(self): |
| 1958 | """ |
nothing calls this directly
no test coverage detected