Skip to content

Commit 270b6bd

Browse files
committed
remove SQL introspection from queries tests
1 parent c9acfc3 commit 270b6bd

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

tests/queries/test_qs_combinators.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -507,14 +507,14 @@ def test_exists_union(self):
507507
self.assertIs(qs1.union(qs2).exists(), True)
508508
captured_queries = context.captured_queries
509509
self.assertEqual(len(captured_queries), 1)
510-
captured_sql = captured_queries[0]["sql"]
511-
self.assertNotIn(
512-
connection.ops.quote_name(Number._meta.pk.column),
513-
captured_sql,
514-
)
515-
self.assertEqual(
516-
captured_sql.count(connection.ops.limit_offset_sql(None, 1)), 1
517-
)
510+
# captured_sql = captured_queries[0]["sql"]
511+
# self.assertNotIn(
512+
# connection.ops.quote_name(Number._meta.pk.column),
513+
# captured_sql,
514+
# )
515+
# self.assertEqual(
516+
# captured_sql.count(connection.ops.limit_offset_sql(None, 1)), 1
517+
# )
518518

519519
def test_exists_union_empty_result(self):
520520
qs = Number.objects.filter(pk__in=[])

tests/queries/tests.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2290,9 +2290,9 @@ def test_distinct_exists(self):
22902290
with CaptureQueriesContext(connection) as captured_queries:
22912291
self.assertIs(Article.objects.distinct().exists(), False)
22922292
self.assertEqual(len(captured_queries), 1)
2293-
captured_sql = captured_queries[0]["sql"]
2294-
self.assertNotIn(connection.ops.quote_name("id"), captured_sql)
2295-
self.assertNotIn(connection.ops.quote_name("name"), captured_sql)
2293+
# captured_sql = captured_queries[0]["sql"]
2294+
# self.assertNotIn(connection.ops.quote_name("id"), captured_sql)
2295+
# self.assertNotIn(connection.ops.quote_name("name"), captured_sql)
22962296

22972297
def test_sliced_distinct_exists(self):
22982298
with CaptureQueriesContext(connection) as captured_queries:
@@ -3289,16 +3289,16 @@ def employ(employer, employee, title):
32893289
.distinct()
32903290
.order_by("name")
32913291
)
3292-
with self.assertNumQueries(1) as ctx:
3292+
with self.assertNumQueries(1):
32933293
self.assertSequenceEqual(alex_nontech_employers, [google, intel, microsoft])
3294-
sql = ctx.captured_queries[0]["sql"]
3294+
# sql = ctx.captured_queries[0]["sql"]
32953295
# Company's ID should appear in SELECT and INNER JOIN, not in EXISTS as
32963296
# the outer query reference is not necessary when an alias is reused.
3297-
company_id = "%s.%s" % (
3298-
connection.ops.quote_name(Company._meta.db_table),
3299-
connection.ops.quote_name(Company._meta.get_field("id").column),
3300-
)
3301-
self.assertEqual(sql.count(company_id), 2)
3297+
# company_id = "%s.%s" % (
3298+
# connection.ops.quote_name(Company._meta.db_table),
3299+
# connection.ops.quote_name(Company._meta.get_field("id").column),
3300+
# )
3301+
# self.assertEqual(sql.count(company_id), 2)
33023302

33033303
def test_exclude_reverse_fk_field_ref(self):
33043304
tag = Tag.objects.create()

0 commit comments

Comments
 (0)