diff options
| author | Bendeguz Csirmaz <csirmazbendeguz@gmail.com> | 2024-07-18 18:33:09 +0800 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-07-22 08:34:29 +0200 |
| commit | bdd538488c837edec74cbfd4b0064228373319a1 (patch) | |
| tree | 1d434b5ab066d01a0064127e4af54d36beccc2b7 /tests/foreign_object | |
| parent | b21f6d7ee41ff09e1ff16d2bbb929464f6939d37 (diff) | |
Fixed #35614 -- Prevented SQLCompiler.as_subquery_condition() from mutating a query.
Diffstat (limited to 'tests/foreign_object')
| -rw-r--r-- | tests/foreign_object/tests.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/foreign_object/tests.py b/tests/foreign_object/tests.py index c9e8da5792..2d3aa800f7 100644 --- a/tests/foreign_object/tests.py +++ b/tests/foreign_object/tests.py @@ -223,6 +223,13 @@ class MultiColumnFKTests(TestCase): [m2], ) + def test_query_does_not_mutate(self): + """ + Recompiling the same subquery doesn't mutate it. + """ + queryset = Friendship.objects.filter(to_friend__in=Person.objects.all()) + self.assertEqual(str(queryset.query), str(queryset.query)) + def test_select_related_foreignkey_forward_works(self): Membership.objects.create( membership_country=self.usa, person=self.bob, group=self.cia |
