-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Closed
Labels
Description
A serializer with many=True
returns a list of dicts when accessing serializer.errors
or serializer.validated_data
. If these are empty, however, an empty dict is returned (just as when many=False
). I believe that it would be more consistent to return an empty list in this case.
Example test case: https://github.com/tomchristie/django-rest-framework/compare/tomchristie:master...nip3o:empty-errors?expand=1
==================================================================================== FAILURES ====================================================================================
_______________________________________________________________ BulkCreateSerializerTests.test_bulk_create_errors ________________________________________________________________
tests/test_serializer_bulk_update.py:80: in test_bulk_create_errors
self.assertEqual(serializer.validated_data, [])
E AssertionError: {} != []
_______________________________________________________________ BulkCreateSerializerTests.test_bulk_create_success _______________________________________________________________
tests/test_serializer_bulk_update.py:49: in test_bulk_create_success
self.assertEqual(serializer.errors, [])
E AssertionError: {} != []
================================================================ 2 failed, 743 passed, 2 warnings in 7.98 seconds ===============================================================
ethagnawl