Skip to content

Commit a31ec40

Browse files
committed
remove SQL introspection from queries tests
1 parent 865b93a commit a31ec40

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
@@ -481,14 +481,14 @@ def test_exists_union(self):
481481
self.assertIs(qs1.union(qs2).exists(), True)
482482
captured_queries = context.captured_queries
483483
self.assertEqual(len(captured_queries), 1)
484-
captured_sql = captured_queries[0]["sql"]
485-
self.assertNotIn(
486-
connection.ops.quote_name(Number._meta.pk.column),
487-
captured_sql,
488-
)
489-
self.assertEqual(
490-
captured_sql.count(connection.ops.limit_offset_sql(None, 1)), 1
491-
)
484+
# captured_sql = captured_queries[0]["sql"]
485+
# self.assertNotIn(
486+
# connection.ops.quote_name(Number._meta.pk.column),
487+
# captured_sql,
488+
# )
489+
# self.assertEqual(
490+
# captured_sql.count(connection.ops.limit_offset_sql(None, 1)), 1
491+
# )
492492

493493
def test_exists_union_empty_result(self):
494494
qs = Number.objects.filter(pk__in=[])

tests/queries/tests.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2268,9 +2268,9 @@ def test_distinct_exists(self):
22682268
with CaptureQueriesContext(connection) as captured_queries:
22692269
self.assertIs(Article.objects.distinct().exists(), False)
22702270
self.assertEqual(len(captured_queries), 1)
2271-
captured_sql = captured_queries[0]["sql"]
2272-
self.assertNotIn(connection.ops.quote_name("id"), captured_sql)
2273-
self.assertNotIn(connection.ops.quote_name("name"), captured_sql)
2271+
# captured_sql = captured_queries[0]["sql"]
2272+
# self.assertNotIn(connection.ops.quote_name("id"), captured_sql)
2273+
# self.assertNotIn(connection.ops.quote_name("name"), captured_sql)
22742274

22752275
def test_sliced_distinct_exists(self):
22762276
with CaptureQueriesContext(connection) as captured_queries:
@@ -3267,16 +3267,16 @@ def employ(employer, employee, title):
32673267
.distinct()
32683268
.order_by("name")
32693269
)
3270-
with self.assertNumQueries(1) as ctx:
3270+
with self.assertNumQueries(1):
32713271
self.assertSequenceEqual(alex_nontech_employers, [google, intel, microsoft])
3272-
sql = ctx.captured_queries[0]["sql"]
3272+
# sql = ctx.captured_queries[0]["sql"]
32733273
# Company's ID should appear in SELECT and INNER JOIN, not in EXISTS as
32743274
# the outer query reference is not necessary when an alias is reused.
3275-
company_id = "%s.%s" % (
3276-
connection.ops.quote_name(Company._meta.db_table),
3277-
connection.ops.quote_name(Company._meta.get_field("id").column),
3278-
)
3279-
self.assertEqual(sql.count(company_id), 2)
3275+
# company_id = "%s.%s" % (
3276+
# connection.ops.quote_name(Company._meta.db_table),
3277+
# connection.ops.quote_name(Company._meta.get_field("id").column),
3278+
# )
3279+
# self.assertEqual(sql.count(company_id), 2)
32803280

32813281
def test_exclude_reverse_fk_field_ref(self):
32823282
tag = Tag.objects.create()

0 commit comments

Comments
 (0)