Skip to content

Commit

Permalink
test: improve tests coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
swistakm committed Apr 11, 2017
1 parent 7ca1ac7 commit 957a1c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/graceful/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def _(names):
for name, value in names.items()
}
else:
return names
return names # pragma: nocover

raise DeserializationError(_(missing), _(forbidden), _(invalid))

Expand Down
14 changes: 10 additions & 4 deletions tests/test_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 957a1c3

Please sign in to comment.