From: Lele Gaifax Date: Wed, 2 Nov 2022 07:32:55 +0000 (+0100) Subject: Use literal_column() instead of literal() in test X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F8707%2Fhead;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Use literal_column() instead of literal() in test This is an attempt to workaround an issue with asyncpg, where passing a literal range as argument causes the following error: : invalid input for query argument $1: 'empty' (list, tuple or Range object expected (got type )) --- diff --git a/test/dialect/postgresql/test_dialect.py b/test/dialect/postgresql/test_dialect.py index 608843b596..7bb3740f51 100644 --- a/test/dialect/postgresql/test_dialect.py +++ b/test/dialect/postgresql/test_dialect.py @@ -1232,8 +1232,8 @@ class TestRange(fixtures.TestBase): ) def test_contains_value(self, connection, rrepr, v): q = select( - literal(rrepr, INT4RANGE), - literal(rrepr, INT4RANGE).contains(v), + literal_column(f"'{rrepr}'::int4range", INT4RANGE), + literal_column(f"'{rrepr}'::int4range", INT4RANGE).contains(v), ) r, expected = connection.execute(q).first() eq_(r.contains(v), expected)