Updated null_queries tests to avoid clashing with the __second lookup.

This commit is contained in:
Aymeric Augustin 2013-02-11 10:05:55 +01:00
parent c01bbb3235
commit 104d82a777
2 changed files with 5 additions and 4 deletions

View File

@ -28,4 +28,5 @@ class OuterB(models.Model):
class Inner(models.Model):
first = models.ForeignKey(OuterA)
second = models.ForeignKey(OuterB, null=True)
# second would clash with the __second lookup.
third = models.ForeignKey(OuterB, null=True)

View File

@ -55,17 +55,17 @@ class NullQueriesTests(TestCase):
"""
obj = OuterA.objects.create()
self.assertQuerysetEqual(
OuterA.objects.filter(inner__second=None),
OuterA.objects.filter(inner__third=None),
['<OuterA: OuterA object>']
)
self.assertQuerysetEqual(
OuterA.objects.filter(inner__second__data=None),
OuterA.objects.filter(inner__third__data=None),
['<OuterA: OuterA object>']
)
inner_obj = Inner.objects.create(first=obj)
self.assertQuerysetEqual(
Inner.objects.filter(first__inner__second=None),
Inner.objects.filter(first__inner__third=None),
['<Inner: Inner object>']
)