MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_text

Method test_text

test/sql/test_statement_params.py:185–202  ·  view source on GitHub ↗
(self, connection)

Source from the content-addressed store, hash-verified

183 eq_(cs(stmt2.params({"x": x1}).params({"y": x2})).all(), [x1, x2])
184
185 def test_text(self, connection):
186 a = self.tables.a
187
188 cs = connection.scalars
189
190 for _ in range(3):
191 x0 = random.randint(1, 10)
192 stmt = text("select data from a where data = :x").params(x=x0)
193 eq_(cs(stmt).all(), [x0])
194
195 x1 = random.randint(1, 10)
196 eq_(cs(stmt.params({"x": x1})).all(), [x1])
197
198 x2 = random.randint(1, 10)
199 stmt2 = stmt.columns(a.c.data).params(x=x2)
200 eq_(cs(stmt2).all(), [x2])
201 eq_(cs(stmt2, {"x": 1}).all(), [1])
202 eq_(cs(stmt2.params(x=1)).all(), [1])

Callers

nothing calls this directly

Calls 5

textFunction · 0.90
eq_Function · 0.90
paramsMethod · 0.45
allMethod · 0.45
columnsMethod · 0.45

Tested by

no test coverage detected