MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_bind_in

Method test_bind_in

test/sql/test_query.py:826–846  ·  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

824
825 @testing.skip_if(["mssql"])
826 def test_bind_in(self, connection):
827 """test calling IN against a bind parameter.
828
829 this isn't allowed on several platforms since we
830 generate ? = ?.
831
832 """
833
834 users = self.tables.users
835
836 connection.execute(users.insert(), dict(user_id=7, user_name="jack"))
837 connection.execute(users.insert(), dict(user_id=8, user_name="fred"))
838 connection.execute(users.insert(), dict(user_id=9, user_name=None))
839
840 u = bindparam("search_key", type_=String)
841
842 s = users.select().where(not_(u.in_([])))
843 r = connection.execute(s, dict(search_key="john")).fetchall()
844 assert len(r) == 3
845 r = connection.execute(s, dict(search_key=None)).fetchall()
846 assert len(r) == 3
847
848 def test_literal_in(self, connection):
849 """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