mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Fixed isolation of GenericRelationTests.test_filter_targets_related_pk().
This commit is contained in:
parent
90ba716bf0
commit
7bb0605a8c
@ -228,9 +228,11 @@ class GenericRelationTests(TestCase):
|
||||
self.assertEqual(qs.filter(links__sum__isnull=False).count(), 0)
|
||||
|
||||
def test_filter_targets_related_pk(self):
|
||||
HasLinkThing.objects.create()
|
||||
hs2 = HasLinkThing.objects.create()
|
||||
link = Link.objects.create(content_object=hs2)
|
||||
# Use hardcoded PKs to ensure different PKs for "link" and "hs2"
|
||||
# objects.
|
||||
HasLinkThing.objects.create(pk=1)
|
||||
hs2 = HasLinkThing.objects.create(pk=2)
|
||||
link = Link.objects.create(content_object=hs2, pk=1)
|
||||
self.assertNotEqual(link.object_id, link.pk)
|
||||
self.assertSequenceEqual(HasLinkThing.objects.filter(links=link.pk), [hs2])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user