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

Method test_required

tests/test_fields.py:134–141  ·  view source on GitHub ↗

By default a field must be included in the input.

(self)

Source from the content-addressed store, hash-verified

132 Tests for `required`, `allow_null`, `allow_blank`, `default`.
133 """
134 def test_required(self):
135 """
136 By default a field must be included in the input.
137 """
138 field = serializers.IntegerField()
139 with pytest.raises(serializers.ValidationError) as exc_info:
140 field.run_validation()
141 assert exc_info.value.detail == ['This field is required.']
142
143 def test_not_required(self):
144 """

Callers

nothing calls this directly

Calls 1

run_validationMethod · 0.45

Tested by

no test coverage detected