MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_bind_in

Method test_bind_in

test/sql/test_query.py:758–778  ·  view source on GitHub ↗

test calling IN against a bind parameter. this isn't allowed on several platforms since we generate ? = ?.

(self, connection)

Source from the content-addressed store, hash-verified

756
757 @testing.skip_if(["mssql"])
758 def test_bind_in(self, connection):
759 """test calling IN against a bind parameter.
760
761 this isn't allowed on several platforms since we
762 generate ? = ?.
763
764 """
765
766 users = self.tables.users
767
768 connection.execute(users.insert(), dict(user_id=7, user_name="jack"))
769 connection.execute(users.insert(), dict(user_id=8, user_name="fred"))
770 connection.execute(users.insert(), dict(user_id=9, user_name=None))
771
772 u = bindparam("search_key", type_=String)
773
774 s = users.select().where(not_(u.in_([])))
775 r = connection.execute(s, dict(search_key="john")).fetchall()
776 assert len(r) == 3
777 r = connection.execute(s, dict(search_key=None)).fetchall()
778 assert len(r) == 3
779
780 def test_literal_in(self, connection):
781 """similar to test_bind_in but use a bind with a value."""

Callers

nothing calls this directly

Calls 8

bindparamFunction · 0.90
not_Function · 0.90
executeMethod · 0.45
insertMethod · 0.45
whereMethod · 0.45
selectMethod · 0.45
in_Method · 0.45
fetchallMethod · 0.45

Tested by

no test coverage detected