conn = psycopg.connect(dsn, context=ctx)
cur = conn.execute("select %s", ["hello"])
- assert cur.fetchone()[0] == "hellot"
+ assert cur.fetchone()[0] == "hellot" # type: ignore[index]
cur = conn.execute("select %b", ["hello"])
- assert cur.fetchone()[0] == "hellob"
+ assert cur.fetchone()[0] == "hellob" # type: ignore[index]
def test_connect_context_copy(dsn, conn):
conn2 = psycopg.connect(dsn, context=conn)
cur = conn2.execute("select %s", ["hello"])
- assert cur.fetchone()[0] == "hellot"
+ assert cur.fetchone()[0] == "hellot" # type: ignore[index]
cur = conn2.execute("select %b", ["hello"])
- assert cur.fetchone()[0] == "hellob"
+ assert cur.fetchone()[0] == "hellob" # type: ignore[index]
conn = await psycopg.AsyncConnection.connect(dsn, context=ctx)
cur = await conn.execute("select %s", ["hello"])
- assert (await cur.fetchone())[0] == "hellot"
+ assert (await cur.fetchone())[0] == "hellot" # type: ignore[index]
cur = await conn.execute("select %b", ["hello"])
- assert (await cur.fetchone())[0] == "hellob"
+ assert (await cur.fetchone())[0] == "hellob" # type: ignore[index]
async def test_connect_context_copy(dsn, aconn):
aconn2 = await psycopg.AsyncConnection.connect(dsn, context=aconn)
cur = await aconn2.execute("select %s", ["hello"])
- assert (await cur.fetchone())[0] == "hellot"
+ assert (await cur.fetchone())[0] == "hellot" # type: ignore[index]
cur = await aconn2.execute("select %b", ["hello"])
- assert (await cur.fetchone())[0] == "hellob"
+ assert (await cur.fetchone())[0] == "hellob" # type: ignore[index]
@pytest.mark.skipif(sys.platform != "win32", reason="windows only test")