diff --git a/src/graceful/serializers.py b/src/graceful/serializers.py index 6667bf9..7af5fc3 100644 --- a/src/graceful/serializers.py +++ b/src/graceful/serializers.py @@ -259,7 +259,7 @@ def _(names): for name, value in names.items() } else: - return names + return names # pragma: nocover raise DeserializationError(_(missing), _(forbidden), _(invalid)) diff --git a/tests/test_serializers.py b/tests/test_serializers.py index f8b9480..7ec4804 100644 --- a/tests/test_serializers.py +++ b/tests/test_serializers.py @@ -207,15 +207,21 @@ def test_serializer_source_wildcard(): def test_serializer_source_field_with_wildcard(): class ExampleSerializer(BaseSerializer): - instance = ExampleField( + starfield = ExampleField( details='whole object instance goes here', source='*', ) serializer = ExampleSerializer() - instance = {'foo', 'bar'} - - assert serializer.to_representation(instance)['instance'] == instance + instance = {'foo': 'bar'} + representation = {"starfield": "bizbaz"} + + assert serializer.to_representation( + instance + )['starfield'] == instance + assert serializer.from_representation( + representation + )['starfield'] == representation["starfield"] def test_serializer_describe():