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

Method test_disallow_null

tests/test_fields.py:151–158  ·  view source on GitHub ↗

By default `None` is not a valid input.

(self)

Source from the content-addressed store, hash-verified

149 field.run_validation()
150
151 def test_disallow_null(self):
152 """
153 By default `None` is not a valid input.
154 """
155 field = serializers.IntegerField()
156 with pytest.raises(serializers.ValidationError) as exc_info:
157 field.run_validation(None)
158 assert exc_info.value.detail == ['This field may not be null.']
159
160 def test_allow_null(self):
161 """

Callers

nothing calls this directly

Calls 1

run_validationMethod · 0.45

Tested by

no test coverage detected