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

Method test_not_required

tests/test_fields.py:143–149  ·  view source on GitHub ↗

If `required=False` then a field may be omitted from the input.

(self)

Source from the content-addressed store, hash-verified

141 assert exc_info.value.detail == ['This field is required.']
142
143 def test_not_required(self):
144 """
145 If `required=False` then a field may be omitted from the input.
146 """
147 field = serializers.IntegerField(required=False)
148 with pytest.raises(serializers.SkipField):
149 field.run_validation()
150
151 def test_disallow_null(self):
152 """

Callers

nothing calls this directly

Calls 1

run_validationMethod · 0.45

Tested by

no test coverage detected