From 957a1c3164b91c64f4b0e64e1901536aeb2aeecd Mon Sep 17 00:00:00 2001 From: mjaworski Date: Tue, 11 Apr 2017 13:20:57 +0200 Subject: [PATCH] test: improve tests coverage --- src/graceful/serializers.py | 2 +- tests/test_serializers.py | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) 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():