Merge branch 'master' into pyts0

This commit is contained in:
Asif Saifuddin Auvi 2017-01-04 18:43:55 +06:00 committed by GitHub
commit 6ca7f76c67

View File

@ -44,8 +44,7 @@ class InheritedModelSerializationTests(TestCase):
""" """
child = ChildModel(name1='parent name', name2='child name') child = ChildModel(name1='parent name', name2='child name')
serializer = DerivedModelSerializer(child) serializer = DerivedModelSerializer(child)
self.assertEqual(set(serializer.data.keys()), assert set(serializer.data.keys()) == set(['name1', 'name2', 'id'])
set(['name1', 'name2', 'id']))
def test_onetoone_primary_key_model_fields_as_expected(self): def test_onetoone_primary_key_model_fields_as_expected(self):
""" """
@ -55,8 +54,7 @@ class InheritedModelSerializationTests(TestCase):
parent = ParentModel.objects.create(name1='parent name') parent = ParentModel.objects.create(name1='parent name')
associate = AssociatedModel.objects.create(name='hello', ref=parent) associate = AssociatedModel.objects.create(name='hello', ref=parent)
serializer = AssociatedModelSerializer(associate) serializer = AssociatedModelSerializer(associate)
self.assertEqual(set(serializer.data.keys()), assert set(serializer.data.keys()) == set(['name', 'ref'])
set(['name', 'ref']))
def test_data_is_valid_without_parent_ptr(self): def test_data_is_valid_without_parent_ptr(self):
""" """
@ -68,4 +66,4 @@ class InheritedModelSerializationTests(TestCase):
'name2': 'child name', 'name2': 'child name',
} }
serializer = DerivedModelSerializer(data=data) serializer = DerivedModelSerializer(data=data)
self.assertEqual(serializer.is_valid(), True) assert serializer.is_valid() is True