MCPcopy Index your code
hub / github.com/encode/django-rest-framework / test_allow_null

Method test_allow_null

tests/test_fields.py:160–166  ·  view source on GitHub ↗

If `allow_null=True` then `None` is a valid input.

(self)

Source from the content-addressed store, hash-verified

158 assert exc_info.value.detail == ['This field may not be null.']
159
160 def test_allow_null(self):
161 """
162 If `allow_null=True` then `None` is a valid input.
163 """
164 field = serializers.IntegerField(allow_null=True)
165 output = field.run_validation(None)
166 assert output is None
167
168 def test_disallow_blank(self):
169 """

Callers

nothing calls this directly

Calls 1

run_validationMethod · 0.45

Tested by

no test coverage detected