MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_in_subquery_warning

Method test_in_subquery_warning

test/sql/test_operators.py:4877–4890  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4875 self.assert_compile(column("q").in_(stmt), "q IN (SELECT t.x FROM t)")
4876
4877 def test_in_subquery_warning(self):
4878 t = table("t", column("x"))
4879
4880 stmt = select(t.c.x).subquery()
4881
4882 with expect_warnings(
4883 r"Coercing Subquery object into a select\(\) for use in "
4884 r"IN\(\); please pass a select\(\) construct explicitly",
4885 ):
4886 self.assert_compile(
4887 column("q").in_(stmt),
4888 "q IN (SELECT anon_1.x FROM "
4889 "(SELECT t.x AS x FROM t) AS anon_1)",
4890 )
4891
4892 def test_in_subquery_explicit(self):
4893 t = table("t", column("x"))

Callers

nothing calls this directly

Calls 7

tableFunction · 0.90
columnFunction · 0.90
expect_warningsFunction · 0.90
selectFunction · 0.85
assert_compileMethod · 0.80
subqueryMethod · 0.45
in_Method · 0.45

Tested by

no test coverage detected