We override the default `run_validation`, because the validation performed by validators and the `.validate()` method should be coerced into an error dictionary with a 'non_fields_error' key.
(self, data=empty)
| 636 | return dictionary.get(self.field_name, empty) |
| 637 | |
| 638 | def run_validation(self, data=empty): |
| 639 | """ |
| 640 | We override the default `run_validation`, because the validation |
| 641 | performed by validators and the `.validate()` method should |
| 642 | be coerced into an error dictionary with a 'non_fields_error' key. |
| 643 | """ |
| 644 | (is_empty_value, data) = self.validate_empty_values(data) |
| 645 | if is_empty_value: |
| 646 | return data |
| 647 | |
| 648 | value = self.to_internal_value(data) |
| 649 | try: |
| 650 | self.run_validators(value) |
| 651 | value = self.validate(value) |
| 652 | assert value is not None, '.validate() should return the validated data' |
| 653 | except (ValidationError, DjangoValidationError) as exc: |
| 654 | raise ValidationError(detail=as_serializer_error(exc)) |
| 655 | |
| 656 | return value |
| 657 | |
| 658 | def run_child_validation(self, data): |
| 659 | """ |
no test coverage detected