summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/queries/tests.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/queries/tests.py b/tests/queries/tests.py
index 8f0af65c8d..b0999be3f8 100644
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -1645,6 +1645,8 @@ class Queries5Tests(TestCase):
def test_ticket9848(self):
# Make sure that updates which only filter on sub-tables don't
# inadvertently update the wrong records (bug #9848).
+ author_start = Author.objects.get(name='a1')
+ ranking_start = Ranking.objects.get(author__name='a1')
# Make sure that the IDs from different tables don't happen to match.
self.assertQuerysetEqual(
@@ -1652,12 +1654,14 @@ class Queries5Tests(TestCase):
['<Ranking: 3: a1>']
)
self.assertEqual(
- Ranking.objects.filter(author__name='a1').update(rank='4'),
+ Ranking.objects.filter(author__name='a1').update(rank=4636),
1
)
- r = Ranking.objects.filter(author__name='a1')[0]
- self.assertNotEqual(r.id, r.author.id)
- self.assertEqual(r.rank, 4)
+
+ r = Ranking.objects.get(author__name='a1')
+ self.assertEqual(r.id, ranking_start.id)
+ self.assertEqual(r.author.id, author_start.id)
+ self.assertEqual(r.rank, 4636)
r.rank = 3
r.save()
self.assertQuerysetEqual(