This is an attempt to workaround an issue with asyncpg, where passing a
literal range as argument causes the following error:
<class 'asyncpg.exceptions.DataError'>: invalid input for query argument $1: 'empty' (list, tuple or Range object expected (got type <class 'str'>))
)
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)