MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_ilike

Method test_ilike

test/sql/test_query.py:229–271  ·  view source on GitHub ↗
(self, connection)

Source from the content-addressed store, hash-verified

227 eq_(connection.scalar(expr), result)
228
229 def test_ilike(self, connection):
230 users = self.tables.users
231 connection.execute(
232 users.insert(),
233 [
234 {"user_id": 1, "user_name": "one"},
235 {"user_id": 2, "user_name": "TwO"},
236 {"user_id": 3, "user_name": "ONE"},
237 {"user_id": 4, "user_name": "OnE"},
238 ],
239 )
240
241 eq_(
242 connection.execute(
243 select(users.c.user_id).where(users.c.user_name.ilike("one"))
244 ).fetchall(),
245 [(1,), (3,), (4,)],
246 )
247
248 eq_(
249 connection.execute(
250 select(users.c.user_id).where(users.c.user_name.ilike("TWO"))
251 ).fetchall(),
252 [(2,)],
253 )
254
255 if testing.against("postgresql"):
256 eq_(
257 connection.execute(
258 select(users.c.user_id).where(
259 users.c.user_name.like("one")
260 )
261 ).fetchall(),
262 [(1,)],
263 )
264 eq_(
265 connection.execute(
266 select(users.c.user_id).where(
267 users.c.user_name.like("TWO")
268 )
269 ).fetchall(),
270 [],
271 )
272
273 def test_repeated_bindparams(self, connection):
274 """Tests that a BindParam can be used more than once.

Callers

nothing calls this directly

Calls 9

eq_Function · 0.90
selectFunction · 0.90
executeMethod · 0.45
insertMethod · 0.45
fetchallMethod · 0.45
whereMethod · 0.45
ilikeMethod · 0.45
againstMethod · 0.45
likeMethod · 0.45

Tested by

no test coverage detected