From: Denis Laxalde Date: Fri, 5 Nov 2021 12:08:56 +0000 (+0100) Subject: Ignore mypy 'index' errors about cursor.fetchone() in connection tests X-Git-Tag: 3.0.3~3^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=472e2559f8fb1e4eff4e5539d86e08e58e92cd8e;p=thirdparty%2Fpsycopg.git Ignore mypy 'index' errors about cursor.fetchone() in connection tests --- 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")