]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Test: fix mypy 0.941 run
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 19 May 2022 21:41:26 +0000 (23:41 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 19 May 2022 21:44:43 +0000 (23:44 +0200)
This seems a mypy shortcoming fixed in 0.950 as the CI didn't complain.
The row factory definition was exotic but arguably correct. Not worth
bumping up the min version for it anyway.

tests/test_connection.py
tests/test_connection_async.py

index bdd3117b7eaaa47eda8294f7b0007d54c5609640..58c6556343116b789bdb5f85c841ea615f50dbd1 100644 (file)
@@ -508,7 +508,7 @@ def test_row_factory(dsn):
     cur = conn.execute("select 'a' as ve")
     assert cur.fetchone() == ["Ave"]
 
-    with conn.cursor(row_factory=lambda c: set) as cur1:
+    with conn.cursor(row_factory=lambda c: lambda t: set(t)) as cur1:
         cur1.execute("select 1, 1, 2")
         assert cur1.fetchall() == [{1, 2}]
 
index 8d48ed69eaa0a2fd0d03ccc68321bd4b3b5ad2cd..93ee762f5f2d2d241b99d0c962d4cc420c598568 100644 (file)
@@ -513,7 +513,7 @@ async def test_row_factory(dsn):
     cur = await conn.execute("select 'a' as ve")
     assert await cur.fetchone() == ["Ave"]
 
-    async with conn.cursor(row_factory=lambda c: set) as cur1:
+    async with conn.cursor(row_factory=lambda c: lambda t: set(t)) as cur1:
         await cur1.execute("select 1, 1, 2")
         assert await cur1.fetchall() == [{1, 2}]