Skip to content

Commit

Permalink
Added missing test for QuerySet.delete() when raising EmptyResultSet.
Browse files Browse the repository at this point in the history
  • Loading branch information
timgraham committed Jan 3, 2025
1 parent aef2f72 commit 63d6fcd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/delete/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,15 @@ def test_fast_delete_aggregation(self):
)
self.assertIs(Base.objects.exists(), False)

def test_fast_delete_empty_result_set(self):
user = User.objects.create()
with self.assertNumQueries(0):
self.assertEqual(
User.objects.filter(pk__in=[]).delete(),
(0, {}),
)
self.assertSequenceEqual(User.objects.all(), [user])

def test_fast_delete_full_match(self):
avatar = Avatar.objects.create(desc="bar")
User.objects.create(avatar=avatar)
Expand Down

0 comments on commit 63d6fcd

Please sign in to comment.