PEP8-ify PR #67 and fix trailing whitespace
Camp rule: leave things in a better state then you found it.fix_request_path_info
parent
261e382556
commit
ca6fba91ba
|
|
@ -281,7 +281,7 @@ class RelatedNameClash(ShowFieldType, PolymorphicModel):
|
||||||
|
|
||||||
#class with a parent_link to superclass, and a related_name back to subclass
|
#class with a parent_link to superclass, and a related_name back to subclass
|
||||||
class TestParentLinkAndRelatedName(ModelShow1_plain):
|
class TestParentLinkAndRelatedName(ModelShow1_plain):
|
||||||
superclass = models.OneToOneField(ModelShow1_plain, parent_link=True, related_name = 'related_name_subclass')
|
superclass = models.OneToOneField(ModelShow1_plain, parent_link=True, related_name='related_name_subclass')
|
||||||
|
|
||||||
|
|
||||||
class PolymorphicTests(TestCase):
|
class PolymorphicTests(TestCase):
|
||||||
|
|
@ -831,21 +831,21 @@ class PolymorphicTests(TestCase):
|
||||||
self.assertEqual(o.bar, 'XYZ')
|
self.assertEqual(o.bar, 'XYZ')
|
||||||
|
|
||||||
def test_parent_link_and_related_name(self):
|
def test_parent_link_and_related_name(self):
|
||||||
t = TestParentLinkAndRelatedName(field1 = "TestParentLinkAndRelatedName")
|
t = TestParentLinkAndRelatedName(field1="TestParentLinkAndRelatedName")
|
||||||
t.save()
|
t.save()
|
||||||
p = ModelShow1_plain.objects.get(field1 = "TestParentLinkAndRelatedName")
|
p = ModelShow1_plain.objects.get(field1="TestParentLinkAndRelatedName")
|
||||||
|
|
||||||
#check that p is equal to the
|
#check that p is equal to the
|
||||||
self.assertIsInstance(p, TestParentLinkAndRelatedName)
|
self.assertIsInstance(p, TestParentLinkAndRelatedName)
|
||||||
self.assertEqual(p, t)
|
self.assertEqual(p, t)
|
||||||
|
|
||||||
#check that the accessors to parent and sublass work correctly and return the right object
|
#check that the accessors to parent and sublass work correctly and return the right object
|
||||||
p = ModelShow1_plain.objects.non_polymorphic().get(field1 = "TestParentLinkAndRelatedName")
|
p = ModelShow1_plain.objects.non_polymorphic().get(field1="TestParentLinkAndRelatedName")
|
||||||
self.assertNotEqual(p, t) #p should be Plain1 and t TestParentLinkAndRelatedName, so not equal
|
self.assertNotEqual(p, t) #p should be Plain1 and t TestParentLinkAndRelatedName, so not equal
|
||||||
self.assertEqual(p, t.superclass)
|
self.assertEqual(p, t.superclass)
|
||||||
self.assertEqual(p.related_name_subclass, t)
|
self.assertEqual(p.related_name_subclass, t)
|
||||||
|
|
||||||
#test that we can delete t
|
#test that we can delete the object
|
||||||
t.delete()
|
t.delete()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue