From 472e2559f8fb1e4eff4e5539d86e08e58e92cd8e Mon Sep 17 00:00:00 2001 From: Denis Laxalde Date: Fri, 5 Nov 2021 13:08:56 +0100 Subject: [PATCH] Ignore mypy 'index' errors about cursor.fetchone() in connection tests --- tests/test_connection.py | 8 ++++---- tests/test_connection_async.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test_connection.py b/tests/test_connection.py index 09cf1df92..57c98db2a 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -690,9 +690,9 @@ def test_connect_context(dsn): 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): @@ -702,6 +702,6 @@ 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] diff --git a/tests/test_connection_async.py b/tests/test_connection_async.py index fe608f205..c86bc9f09 100644 --- a/tests/test_connection_async.py +++ b/tests/test_connection_async.py @@ -657,9 +657,9 @@ async def test_connect_context_adapters(dsn): 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): @@ -669,9 +669,9 @@ 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") -- 2.47.2