Skip to content

Commit

Permalink
remove redundant asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
WaVEV committed Jan 23, 2025
1 parent b898209 commit 83f31d9
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions tests/model_fields_/test_embedded_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,22 +254,18 @@ def test_exists_subquery(self):
author__name=OuterRef("author__name"), author__address__city="Boston"
)
queryset = Book.objects.filter(Exists(subquery)).order_by("name")
self.assertEqual(queryset.count(), 3)
self.assertQuerySetEqual(queryset, ["Book 2", "Book 3", "Book 4"], lambda book: book.name)

def test_in_subquery(self):
subquery = Book.objects.filter(author__age__gt=35).values("author__name")
queryset = Book.objects.filter(author__name__in=subquery).order_by("name")
self.assertEqual(queryset.count(), 3)
self.assertQuerySetEqual(queryset, ["Book 2", "Book 3", "Book 4"], lambda book: book.name)

def test_exists_with_foreign_object(self):
subquery = Library.objects.filter(best_seller=OuterRef("name"))
queryset = Book.objects.filter(Exists(subquery))
self.assertEqual(queryset.count(), 1)
self.assertEqual(queryset.first().name, "Book 1")

def test_foreign_field_with_ranges(self):
queryset = Library.objects.filter(books__author__age__range=(25, 35))
self.assertEqual(queryset.count(), 1)
self.assertEqual(queryset.first().name, "Central Library")

0 comments on commit 83f31d9

Please sign in to comment.