]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Ignore mypy 'index' errors about cursor.fetchone() in connection tests
authorDenis Laxalde <denis.laxalde@dalibo.com>
Fri, 5 Nov 2021 12:08:56 +0000 (13:08 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 10 Nov 2021 01:57:39 +0000 (02:57 +0100)
tests/test_connection.py
tests/test_connection_async.py

index 09cf1df9291bb51068cd96a9bfdadef472747c8c..57c98db2a758eff580bc9808e20bbdcb64480b0c 100644 (file)
@@ -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]
index fe608f2053b3c65981d81ed55cc039e9d81bf814..c86bc9f0956524b479acf06bd9f0d5f2bec98a2f 100644 (file)
@@ -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")