Replaced assertQuerysetEqual() to assertSequenceEqual()/assertCountEqual() where appropriate.
Follow up to 3f7b327562
.
This commit is contained in:
parent
564b317fb5
commit
d795259ea9
|
@ -148,7 +148,7 @@ class LogEntryTests(TestCase):
|
||||||
)
|
)
|
||||||
response = self.client.post(change_url, post_data)
|
response = self.client.post(change_url, post_data)
|
||||||
self.assertRedirects(response, reverse("admin:admin_utils_site_changelist"))
|
self.assertRedirects(response, reverse("admin:admin_utils_site_changelist"))
|
||||||
self.assertQuerysetEqual(Article.objects.filter(pk=a2.pk), [])
|
self.assertSequenceEqual(Article.objects.filter(pk=a2.pk), [])
|
||||||
logentry = LogEntry.objects.filter(content_type__model__iexact="site").latest(
|
logentry = LogEntry.objects.filter(content_type__model__iexact="site").latest(
|
||||||
"action_time"
|
"action_time"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1687,7 +1687,7 @@ class AggregateTestCase(TestCase):
|
||||||
authors = Author.objects.annotate(
|
authors = Author.objects.annotate(
|
||||||
Count("book"),
|
Count("book"),
|
||||||
).filter(Q(book__count__gt=0) | Q(pk__in=Book.objects.values("authors")))
|
).filter(Q(book__count__gt=0) | Q(pk__in=Book.objects.values("authors")))
|
||||||
self.assertQuerysetEqual(authors, Author.objects.all(), ordered=False)
|
self.assertCountEqual(authors, Author.objects.all())
|
||||||
|
|
||||||
def test_aggregation_random_ordering(self):
|
def test_aggregation_random_ordering(self):
|
||||||
"""Random() is not included in the GROUP BY when used for ordering."""
|
"""Random() is not included in the GROUP BY when used for ordering."""
|
||||||
|
|
|
@ -759,10 +759,10 @@ class AggregationTests(TestCase):
|
||||||
qs = Clues.objects.values("EntryID__Entry").annotate(
|
qs = Clues.objects.values("EntryID__Entry").annotate(
|
||||||
Appearances=Count("EntryID"), Distinct_Clues=Count("Clue", distinct=True)
|
Appearances=Count("EntryID"), Distinct_Clues=Count("Clue", distinct=True)
|
||||||
)
|
)
|
||||||
self.assertQuerysetEqual(qs, [])
|
self.assertSequenceEqual(qs, [])
|
||||||
|
|
||||||
qs = Entries.objects.annotate(clue_count=Count("clues__ID"))
|
qs = Entries.objects.annotate(clue_count=Count("clues__ID"))
|
||||||
self.assertQuerysetEqual(qs, [])
|
self.assertSequenceEqual(qs, [])
|
||||||
|
|
||||||
def test_boolean_conversion(self):
|
def test_boolean_conversion(self):
|
||||||
# Aggregates mixed up ordering of columns for backend's convert_values
|
# Aggregates mixed up ordering of columns for backend's convert_values
|
||||||
|
|
|
@ -17,14 +17,7 @@ class CustomColumnsTests(TestCase):
|
||||||
cls.article.authors.set(cls.authors)
|
cls.article.authors.set(cls.authors)
|
||||||
|
|
||||||
def test_query_all_available_authors(self):
|
def test_query_all_available_authors(self):
|
||||||
self.assertQuerysetEqual(
|
self.assertSequenceEqual(Author.objects.all(), [self.a2, self.a1])
|
||||||
Author.objects.all(),
|
|
||||||
[
|
|
||||||
"Peter Jones",
|
|
||||||
"John Smith",
|
|
||||||
],
|
|
||||||
str,
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_get_first_name(self):
|
def test_get_first_name(self):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
@ -33,12 +26,9 @@ class CustomColumnsTests(TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_filter_first_name(self):
|
def test_filter_first_name(self):
|
||||||
self.assertQuerysetEqual(
|
self.assertSequenceEqual(
|
||||||
Author.objects.filter(first_name__exact="John"),
|
Author.objects.filter(first_name__exact="John"),
|
||||||
[
|
[self.a1],
|
||||||
"John Smith",
|
|
||||||
],
|
|
||||||
str,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_field_error(self):
|
def test_field_error(self):
|
||||||
|
@ -57,14 +47,7 @@ class CustomColumnsTests(TestCase):
|
||||||
self.a1.last
|
self.a1.last
|
||||||
|
|
||||||
def test_get_all_authors_for_an_article(self):
|
def test_get_all_authors_for_an_article(self):
|
||||||
self.assertQuerysetEqual(
|
self.assertSequenceEqual(self.article.authors.all(), [self.a2, self.a1])
|
||||||
self.article.authors.all(),
|
|
||||||
[
|
|
||||||
"Peter Jones",
|
|
||||||
"John Smith",
|
|
||||||
],
|
|
||||||
str,
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_get_all_articles_for_an_author(self):
|
def test_get_all_articles_for_an_author(self):
|
||||||
self.assertQuerysetEqual(
|
self.assertQuerysetEqual(
|
||||||
|
@ -76,8 +59,8 @@ class CustomColumnsTests(TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_get_author_m2m_relation(self):
|
def test_get_author_m2m_relation(self):
|
||||||
self.assertQuerysetEqual(
|
self.assertSequenceEqual(
|
||||||
self.article.authors.filter(last_name="Jones"), ["Peter Jones"], str
|
self.article.authors.filter(last_name="Jones"), [self.a2]
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_author_querying(self):
|
def test_author_querying(self):
|
||||||
|
|
|
@ -25,39 +25,13 @@ class BasicCustomPKTests(TestCase):
|
||||||
"""
|
"""
|
||||||
Both pk and custom attribute_name can be used in filter and friends
|
Both pk and custom attribute_name can be used in filter and friends
|
||||||
"""
|
"""
|
||||||
self.assertQuerysetEqual(
|
self.assertSequenceEqual(Employee.objects.filter(pk=123), [self.dan])
|
||||||
Employee.objects.filter(pk=123),
|
self.assertSequenceEqual(Employee.objects.filter(employee_code=123), [self.dan])
|
||||||
[
|
self.assertSequenceEqual(
|
||||||
"Dan Jones",
|
|
||||||
],
|
|
||||||
str,
|
|
||||||
)
|
|
||||||
|
|
||||||
self.assertQuerysetEqual(
|
|
||||||
Employee.objects.filter(employee_code=123),
|
|
||||||
[
|
|
||||||
"Dan Jones",
|
|
||||||
],
|
|
||||||
str,
|
|
||||||
)
|
|
||||||
|
|
||||||
self.assertQuerysetEqual(
|
|
||||||
Employee.objects.filter(pk__in=[123, 456]),
|
Employee.objects.filter(pk__in=[123, 456]),
|
||||||
[
|
[self.fran, self.dan],
|
||||||
"Fran Bones",
|
|
||||||
"Dan Jones",
|
|
||||||
],
|
|
||||||
str,
|
|
||||||
)
|
|
||||||
|
|
||||||
self.assertQuerysetEqual(
|
|
||||||
Employee.objects.all(),
|
|
||||||
[
|
|
||||||
"Fran Bones",
|
|
||||||
"Dan Jones",
|
|
||||||
],
|
|
||||||
str,
|
|
||||||
)
|
)
|
||||||
|
self.assertSequenceEqual(Employee.objects.all(), [self.fran, self.dan])
|
||||||
|
|
||||||
self.assertQuerysetEqual(
|
self.assertQuerysetEqual(
|
||||||
Business.objects.filter(name="Sears"), ["Sears"], lambda b: b.name
|
Business.objects.filter(name="Sears"), ["Sears"], lambda b: b.name
|
||||||
|
@ -74,13 +48,9 @@ class BasicCustomPKTests(TestCase):
|
||||||
"""
|
"""
|
||||||
Custom pk doesn't affect related_name based lookups
|
Custom pk doesn't affect related_name based lookups
|
||||||
"""
|
"""
|
||||||
self.assertQuerysetEqual(
|
self.assertSequenceEqual(
|
||||||
self.business.employees.all(),
|
self.business.employees.all(),
|
||||||
[
|
[self.fran, self.dan],
|
||||||
"Fran Bones",
|
|
||||||
"Dan Jones",
|
|
||||||
],
|
|
||||||
str,
|
|
||||||
)
|
)
|
||||||
self.assertQuerysetEqual(
|
self.assertQuerysetEqual(
|
||||||
self.fran.business_set.all(),
|
self.fran.business_set.all(),
|
||||||
|
@ -94,21 +64,13 @@ class BasicCustomPKTests(TestCase):
|
||||||
"""
|
"""
|
||||||
Queries across tables, involving primary key
|
Queries across tables, involving primary key
|
||||||
"""
|
"""
|
||||||
self.assertQuerysetEqual(
|
self.assertSequenceEqual(
|
||||||
Employee.objects.filter(business__name="Sears"),
|
Employee.objects.filter(business__name="Sears"),
|
||||||
[
|
[self.fran, self.dan],
|
||||||
"Fran Bones",
|
|
||||||
"Dan Jones",
|
|
||||||
],
|
|
||||||
str,
|
|
||||||
)
|
)
|
||||||
self.assertQuerysetEqual(
|
self.assertSequenceEqual(
|
||||||
Employee.objects.filter(business__pk="Sears"),
|
Employee.objects.filter(business__pk="Sears"),
|
||||||
[
|
[self.fran, self.dan],
|
||||||
"Fran Bones",
|
|
||||||
"Dan Jones",
|
|
||||||
],
|
|
||||||
str,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertQuerysetEqual(
|
self.assertQuerysetEqual(
|
||||||
|
@ -186,13 +148,9 @@ class BasicCustomPKTests(TestCase):
|
||||||
fran.last_name = "Jones"
|
fran.last_name = "Jones"
|
||||||
fran.save()
|
fran.save()
|
||||||
|
|
||||||
self.assertQuerysetEqual(
|
self.assertSequenceEqual(
|
||||||
Employee.objects.filter(last_name="Jones"),
|
Employee.objects.filter(last_name="Jones"),
|
||||||
[
|
[self.dan, fran],
|
||||||
"Dan Jones",
|
|
||||||
"Fran Jones",
|
|
||||||
],
|
|
||||||
str,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ class DatesTests(TestCase):
|
||||||
datetime.date(2010, 7, 28),
|
datetime.date(2010, 7, 28),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
self.assertQuerysetEqual(
|
self.assertSequenceEqual(
|
||||||
Article.objects.dates("comments__approval_date", "day"), []
|
Article.objects.dates("comments__approval_date", "day"), []
|
||||||
)
|
)
|
||||||
self.assertSequenceEqual(
|
self.assertSequenceEqual(
|
||||||
|
|
|
@ -85,7 +85,7 @@ class DateTimesTests(TestCase):
|
||||||
datetime.datetime(2010, 7, 28),
|
datetime.datetime(2010, 7, 28),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
self.assertQuerysetEqual(
|
self.assertSequenceEqual(
|
||||||
Article.objects.datetimes("comments__approval_date", "day"), []
|
Article.objects.datetimes("comments__approval_date", "day"), []
|
||||||
)
|
)
|
||||||
self.assertSequenceEqual(
|
self.assertSequenceEqual(
|
||||||
|
|
|
@ -690,18 +690,18 @@ class LookupTests(TestCase):
|
||||||
|
|
||||||
def test_none(self):
|
def test_none(self):
|
||||||
# none() returns a QuerySet that behaves like any other QuerySet object
|
# none() returns a QuerySet that behaves like any other QuerySet object
|
||||||
self.assertQuerysetEqual(Article.objects.none(), [])
|
self.assertSequenceEqual(Article.objects.none(), [])
|
||||||
self.assertQuerysetEqual(
|
self.assertSequenceEqual(
|
||||||
Article.objects.none().filter(headline__startswith="Article"), []
|
Article.objects.none().filter(headline__startswith="Article"), []
|
||||||
)
|
)
|
||||||
self.assertQuerysetEqual(
|
self.assertSequenceEqual(
|
||||||
Article.objects.filter(headline__startswith="Article").none(), []
|
Article.objects.filter(headline__startswith="Article").none(), []
|
||||||
)
|
)
|
||||||
self.assertEqual(Article.objects.none().count(), 0)
|
self.assertEqual(Article.objects.none().count(), 0)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
Article.objects.none().update(headline="This should not take effect"), 0
|
Article.objects.none().update(headline="This should not take effect"), 0
|
||||||
)
|
)
|
||||||
self.assertQuerysetEqual(Article.objects.none().iterator(), [])
|
self.assertSequenceEqual(list(Article.objects.none().iterator()), [])
|
||||||
|
|
||||||
def test_in(self):
|
def test_in(self):
|
||||||
self.assertSequenceEqual(
|
self.assertSequenceEqual(
|
||||||
|
|
|
@ -68,7 +68,7 @@ class ModelInheritanceTests(TestCase):
|
||||||
# Even though p.supplier for a Place 'p' (a parent of a Supplier), a
|
# Even though p.supplier for a Place 'p' (a parent of a Supplier), a
|
||||||
# Restaurant object cannot access that reverse relation, since it's not
|
# Restaurant object cannot access that reverse relation, since it's not
|
||||||
# part of the Place-Supplier Hierarchy.
|
# part of the Place-Supplier Hierarchy.
|
||||||
self.assertQuerysetEqual(Place.objects.filter(supplier__name="foo"), [])
|
self.assertSequenceEqual(Place.objects.filter(supplier__name="foo"), [])
|
||||||
msg = (
|
msg = (
|
||||||
"Cannot resolve keyword 'supplier' into field. Choices are: "
|
"Cannot resolve keyword 'supplier' into field. Choices are: "
|
||||||
"address, chef, chef_id, id, italianrestaurant, lot, name, "
|
"address, chef, chef_id, id, italianrestaurant, lot, name, "
|
||||||
|
@ -93,7 +93,7 @@ class ModelInheritanceTests(TestCase):
|
||||||
getattr(post, "attached_%(class)s_set")
|
getattr(post, "attached_%(class)s_set")
|
||||||
|
|
||||||
def test_model_with_distinct_related_query_name(self):
|
def test_model_with_distinct_related_query_name(self):
|
||||||
self.assertQuerysetEqual(
|
self.assertSequenceEqual(
|
||||||
Post.objects.filter(attached_model_inheritance_comments__is_spam=True), []
|
Post.objects.filter(attached_model_inheritance_comments__is_spam=True), []
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ class ModelInheritanceTests(TestCase):
|
||||||
self.assertEqual(s.titles.related_val, (s.id,))
|
self.assertEqual(s.titles.related_val, (s.id,))
|
||||||
# Higher level test for correct query values (title foof not
|
# Higher level test for correct query values (title foof not
|
||||||
# accidentally found).
|
# accidentally found).
|
||||||
self.assertQuerysetEqual(s.titles.all(), [])
|
self.assertSequenceEqual(s.titles.all(), [])
|
||||||
|
|
||||||
def test_update_parent_filtering(self):
|
def test_update_parent_filtering(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -882,22 +882,22 @@ class Queries1Tests(TestCase):
|
||||||
Eaten.objects.create(meal="m")
|
Eaten.objects.create(meal="m")
|
||||||
q = Eaten.objects.none()
|
q = Eaten.objects.none()
|
||||||
with self.assertNumQueries(0):
|
with self.assertNumQueries(0):
|
||||||
self.assertQuerysetEqual(q.all(), [])
|
self.assertSequenceEqual(q.all(), [])
|
||||||
self.assertQuerysetEqual(q.filter(meal="m"), [])
|
self.assertSequenceEqual(q.filter(meal="m"), [])
|
||||||
self.assertQuerysetEqual(q.exclude(meal="m"), [])
|
self.assertSequenceEqual(q.exclude(meal="m"), [])
|
||||||
self.assertQuerysetEqual(q.complex_filter({"pk": 1}), [])
|
self.assertSequenceEqual(q.complex_filter({"pk": 1}), [])
|
||||||
self.assertQuerysetEqual(q.select_related("food"), [])
|
self.assertSequenceEqual(q.select_related("food"), [])
|
||||||
self.assertQuerysetEqual(q.annotate(Count("food")), [])
|
self.assertSequenceEqual(q.annotate(Count("food")), [])
|
||||||
self.assertQuerysetEqual(q.order_by("meal", "food"), [])
|
self.assertSequenceEqual(q.order_by("meal", "food"), [])
|
||||||
self.assertQuerysetEqual(q.distinct(), [])
|
self.assertSequenceEqual(q.distinct(), [])
|
||||||
self.assertQuerysetEqual(q.extra(select={"foo": "1"}), [])
|
self.assertSequenceEqual(q.extra(select={"foo": "1"}), [])
|
||||||
self.assertQuerysetEqual(q.reverse(), [])
|
self.assertSequenceEqual(q.reverse(), [])
|
||||||
q.query.low_mark = 1
|
q.query.low_mark = 1
|
||||||
msg = "Cannot change a query once a slice has been taken."
|
msg = "Cannot change a query once a slice has been taken."
|
||||||
with self.assertRaisesMessage(TypeError, msg):
|
with self.assertRaisesMessage(TypeError, msg):
|
||||||
q.extra(select={"foo": "1"})
|
q.extra(select={"foo": "1"})
|
||||||
self.assertQuerysetEqual(q.defer("meal"), [])
|
self.assertSequenceEqual(q.defer("meal"), [])
|
||||||
self.assertQuerysetEqual(q.only("meal"), [])
|
self.assertSequenceEqual(q.only("meal"), [])
|
||||||
|
|
||||||
def test_ticket7791(self):
|
def test_ticket7791(self):
|
||||||
# There were "issues" when ordering and distinct-ing on fields related
|
# There were "issues" when ordering and distinct-ing on fields related
|
||||||
|
@ -964,7 +964,7 @@ class Queries1Tests(TestCase):
|
||||||
def g():
|
def g():
|
||||||
yield n_obj.pk
|
yield n_obj.pk
|
||||||
|
|
||||||
self.assertQuerysetEqual(Note.objects.filter(pk__in=f()), [])
|
self.assertSequenceEqual(Note.objects.filter(pk__in=f()), [])
|
||||||
self.assertEqual(list(Note.objects.filter(pk__in=g())), [n_obj])
|
self.assertEqual(list(Note.objects.filter(pk__in=g())), [n_obj])
|
||||||
|
|
||||||
def test_ticket10742(self):
|
def test_ticket10742(self):
|
||||||
|
@ -1457,7 +1457,7 @@ class Queries2Tests(TestCase):
|
||||||
class Queries3Tests(TestCase):
|
class Queries3Tests(TestCase):
|
||||||
def test_ticket7107(self):
|
def test_ticket7107(self):
|
||||||
# This shouldn't create an infinite loop.
|
# This shouldn't create an infinite loop.
|
||||||
self.assertQuerysetEqual(Valid.objects.all(), [])
|
self.assertSequenceEqual(Valid.objects.all(), [])
|
||||||
|
|
||||||
def test_datetimes_invalid_field(self):
|
def test_datetimes_invalid_field(self):
|
||||||
# An error should be raised when QuerySet.datetimes() is passed the
|
# An error should be raised when QuerySet.datetimes() is passed the
|
||||||
|
@ -1594,7 +1594,7 @@ class Queries4Tests(TestCase):
|
||||||
otherteachers = Teacher.objects.exclude(pk=t1.pk).exclude(friends=t1)
|
otherteachers = Teacher.objects.exclude(pk=t1.pk).exclude(friends=t1)
|
||||||
qs1 = otherteachers.filter(schools=s1).filter(schools=s2)
|
qs1 = otherteachers.filter(schools=s1).filter(schools=s2)
|
||||||
qs2 = otherteachers.filter(schools=s1).filter(schools=s3)
|
qs2 = otherteachers.filter(schools=s1).filter(schools=s3)
|
||||||
self.assertQuerysetEqual(qs1 | qs2, [])
|
self.assertSequenceEqual(qs1 | qs2, [])
|
||||||
|
|
||||||
def test_ticket7095(self):
|
def test_ticket7095(self):
|
||||||
# Updates that are filtered on the model being updated are somewhat
|
# Updates that are filtered on the model being updated are somewhat
|
||||||
|
@ -1666,7 +1666,7 @@ class Queries4Tests(TestCase):
|
||||||
def test_ticket10181(self):
|
def test_ticket10181(self):
|
||||||
# Avoid raising an EmptyResultSet if an inner query is probably
|
# Avoid raising an EmptyResultSet if an inner query is probably
|
||||||
# empty (and hence, not executed).
|
# empty (and hence, not executed).
|
||||||
self.assertQuerysetEqual(
|
self.assertSequenceEqual(
|
||||||
Tag.objects.filter(id__in=Tag.objects.filter(id__in=[])), []
|
Tag.objects.filter(id__in=Tag.objects.filter(id__in=[])), []
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1974,8 +1974,8 @@ class SelectRelatedTests(TestCase):
|
||||||
# Once upon a time, select_related() with circular relations would loop
|
# Once upon a time, select_related() with circular relations would loop
|
||||||
# infinitely if you forgot to specify "depth". Now we set an arbitrary
|
# infinitely if you forgot to specify "depth". Now we set an arbitrary
|
||||||
# default upper bound.
|
# default upper bound.
|
||||||
self.assertQuerysetEqual(X.objects.all(), [])
|
self.assertSequenceEqual(X.objects.all(), [])
|
||||||
self.assertQuerysetEqual(X.objects.select_related(), [])
|
self.assertSequenceEqual(X.objects.select_related(), [])
|
||||||
|
|
||||||
|
|
||||||
class SubclassFKTests(TestCase):
|
class SubclassFKTests(TestCase):
|
||||||
|
@ -2923,8 +2923,8 @@ class WeirdQuerysetSlicingTests(TestCase):
|
||||||
|
|
||||||
def test_tickets_7698_10202(self):
|
def test_tickets_7698_10202(self):
|
||||||
# People like to slice with '0' as the high-water mark.
|
# People like to slice with '0' as the high-water mark.
|
||||||
self.assertQuerysetEqual(Article.objects.all()[0:0], [])
|
self.assertSequenceEqual(Article.objects.all()[0:0], [])
|
||||||
self.assertQuerysetEqual(Article.objects.all()[0:0][:10], [])
|
self.assertSequenceEqual(Article.objects.all()[0:0][:10], [])
|
||||||
self.assertEqual(Article.objects.all()[:0].count(), 0)
|
self.assertEqual(Article.objects.all()[:0].count(), 0)
|
||||||
msg = "Cannot change a query once a slice has been taken."
|
msg = "Cannot change a query once a slice has been taken."
|
||||||
with self.assertRaisesMessage(TypeError, msg):
|
with self.assertRaisesMessage(TypeError, msg):
|
||||||
|
@ -3101,7 +3101,7 @@ class ConditionalTests(TestCase):
|
||||||
# ... but you can still order in a non-recursive fashion among linked
|
# ... but you can still order in a non-recursive fashion among linked
|
||||||
# fields (the previous test failed because the default ordering was
|
# fields (the previous test failed because the default ordering was
|
||||||
# recursive).
|
# recursive).
|
||||||
self.assertQuerysetEqual(LoopX.objects.order_by("y__x__y__x__id"), [])
|
self.assertSequenceEqual(LoopX.objects.order_by("y__x__y__x__id"), [])
|
||||||
|
|
||||||
# When grouping without specifying ordering, we add an explicit "ORDER BY NULL"
|
# When grouping without specifying ordering, we add an explicit "ORDER BY NULL"
|
||||||
# portion in MySQL to prevent unnecessary sorting.
|
# portion in MySQL to prevent unnecessary sorting.
|
||||||
|
@ -3448,7 +3448,7 @@ class ExcludeTest17600(TestCase):
|
||||||
those items not having any orders at all. The correct way to write
|
those items not having any orders at all. The correct way to write
|
||||||
this query in SQL seems to be using two nested subqueries.
|
this query in SQL seems to be using two nested subqueries.
|
||||||
"""
|
"""
|
||||||
self.assertQuerysetEqual(
|
self.assertSequenceEqual(
|
||||||
Order.objects.exclude(~Q(items__status=1)).distinct(),
|
Order.objects.exclude(~Q(items__status=1)).distinct(),
|
||||||
[self.o1],
|
[self.o1],
|
||||||
)
|
)
|
||||||
|
@ -4474,7 +4474,7 @@ class TestTicket24279(TestCase):
|
||||||
def test_ticket_24278(self):
|
def test_ticket_24278(self):
|
||||||
School.objects.create()
|
School.objects.create()
|
||||||
qs = School.objects.filter(Q(pk__in=()) | Q())
|
qs = School.objects.filter(Q(pk__in=()) | Q())
|
||||||
self.assertQuerysetEqual(qs, [])
|
self.assertSequenceEqual(qs, [])
|
||||||
|
|
||||||
|
|
||||||
class TestInvalidValuesRelation(SimpleTestCase):
|
class TestInvalidValuesRelation(SimpleTestCase):
|
||||||
|
|
Loading…
Reference in New Issue