test #12084
(self, user_address_fixture, testing_engine)
| 1918 | ) |
| 1919 | |
| 1920 | def test_bindparam_not_cached(self, user_address_fixture, testing_engine): |
| 1921 | """test #12084""" |
| 1922 | |
| 1923 | users, addresses = user_address_fixture |
| 1924 | |
| 1925 | engine = testing_engine( |
| 1926 | options={"query_cache_size": 0, "sqlite_share_pool": True} |
| 1927 | ) |
| 1928 | with engine.begin() as conn: |
| 1929 | conn.execute( |
| 1930 | users.insert(), |
| 1931 | [{"id": 7, "name": "bar"}, {"id": 8, "name": "foo"}], |
| 1932 | ) |
| 1933 | |
| 1934 | def make_query(stmt, *criteria): |
| 1935 | for crit in criteria: |
| 1936 | stmt += lambda s: s.where(crit) |
| 1937 | |
| 1938 | return stmt |
| 1939 | |
| 1940 | for i in range(2): |
| 1941 | with engine.connect() as conn: |
| 1942 | stmt = lambda_stmt(lambda: select(users)) |
| 1943 | # create a filter criterion that will never match anything |
| 1944 | stmt1 = make_query( |
| 1945 | stmt, |
| 1946 | users.c.name == "bar", |
| 1947 | users.c.name == "foo", |
| 1948 | ) |
| 1949 | |
| 1950 | assert len(conn.scalars(stmt1).all()) == 0 |
| 1951 | |
| 1952 | stmt2 = make_query( |
| 1953 | stmt, |
| 1954 | users.c.name == "bar", |
| 1955 | users.c.name == "bar", |
| 1956 | users.c.name == "foo", |
| 1957 | ) |
| 1958 | |
| 1959 | assert len(conn.scalars(stmt2).all()) == 0 |
| 1960 | |
| 1961 | |
| 1962 | class DeferredLambdaElementTest( |
nothing calls this directly
no test coverage detected