MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_in_expr_compile

Method test_in_expr_compile

test/sql/test_lambdas.py:191–212  ·  view source on GitHub ↗
(self, user_address_fixture)

Source from the content-addressed store, hash-verified

189 eq_(result.all(), [(e["id"],) for e in data if e["name"] in case])
190
191 def test_in_expr_compile(self, user_address_fixture):
192 users, _ = user_address_fixture
193
194 def go(val):
195 stmt = lambdas.lambda_stmt(lambda: select(users.c.id))
196 stmt += lambda s: s.where(users.c.name.in_(val))
197 stmt += lambda s: s.order_by(users.c.id)
198 return stmt
199
200 # note this also requires the type of the bind is copied
201 self.assert_compile(
202 go([]),
203 "SELECT users.id FROM users "
204 "WHERE users.name IN (NULL) AND (1 != 1) ORDER BY users.id",
205 literal_binds=True,
206 )
207 self.assert_compile(
208 go(["u1", "u2"]),
209 "SELECT users.id FROM users "
210 "WHERE users.name IN ('u1', 'u2') ORDER BY users.id",
211 literal_binds=True,
212 )
213
214 def test_bind_type(self, user_address_fixture):
215 users, _ = user_address_fixture

Callers

nothing calls this directly

Calls 2

assert_compileMethod · 0.80
goFunction · 0.50

Tested by

no test coverage detected