Skip to content

Conversation

timgraham
Copy link
Collaborator

Surprisingly, Django's test suite didn't have a suitable regression test, so I'll send this upstream:

diff --git a/tests/delete/tests.py b/tests/delete/tests.py
index 01228631f4..2d2c42dfb1 100644
--- a/tests/delete/tests.py
+++ b/tests/delete/tests.py
@@ -794,6 +794,14 @@ class FastDeleteTests(TestCase):
             )
         self.assertIs(Base.objects.exists(), False)
 
+    def test_fast_delete_empty_result_set(self):
+        User.objects.create()
+        with self.assertNumQueries(0):
+            self.assertEqual(
+                User.objects.filter(pk__in=[]).delete(),
+                (0, {}),
+            )
+
     def test_fast_delete_full_match(self):
         avatar = Avatar.objects.create(desc="bar")
         User.objects.create(avatar=avatar)

@timgraham timgraham merged commit a40e0ae into mongodb:main Dec 30, 2024
10 checks passed
@timgraham timgraham deleted the QuerySet.delete-EmptyResultSet branch December 30, 2024 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants