From: Daniele Varrazzo Date: Thu, 21 Apr 2022 01:48:00 +0000 (+0200) Subject: test(enum): drop unneeded cursor creation X-Git-Tag: 3.1~137^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f501ba5a32196e35e34dcf4a1c66777df3d8f9e2;p=thirdparty%2Fpsycopg.git test(enum): drop unneeded cursor creation --- diff --git a/tests/types/test_enum.py b/tests/types/test_enum.py index dac41c4fe..90cc00d9f 100644 --- a/tests/types/test_enum.py +++ b/tests/types/test_enum.py @@ -229,10 +229,9 @@ async def test_enum_async(aconn, testenum, encoding, fmt_in, fmt_out): name, enum, labels = testenum register_enum(await EnumInfo.fetch(aconn, name), enum, aconn) - async with aconn.cursor(binary=fmt_out) as cur: - for label in labels: - cur = await cur.execute(f"select %{fmt_in}::{name}", [label]) - assert (await cur.fetchone())[0] == enum[label] + for label in labels: + cur = await aconn.execute(f"select %{fmt_in}::{name}", [label], binary=fmt_out) + assert (await cur.fetchone())[0] == enum[label] - cur = await cur.execute(f"select %{fmt_in}", [list(enum)]) - assert (await cur.fetchone())[0] == list(enum) + cur = await cur.execute(f"select %{fmt_in}", [list(enum)]) + assert (await cur.fetchone())[0] == list(enum)