"test": [
"pytest >= 6, < 6.1",
"pytest-asyncio >= 0.14.0, < 0.15",
+ "pytest-randomly >= 3.5, < 3.6",
],
"dev": [
"black",
(b"", b""),
(b"hello", b"hello"),
(b"foo'bar", b"foo''bar"),
- (b"foo\\bar", b"foo\\\\bar"),
+ # This libpq function behaves unpredictably when not passed a conn
+ (b"foo\\bar", (b"foo\\\\bar", b"foo\\bar")),
],
)
def test_escape_string_noconn(data, want):
esc = pq.Escaping()
out = esc.escape_string(data)
- assert out == want
+ if isinstance(want, bytes):
+ assert out == want
+ else:
+ assert out in want
def test_escape_string_badconn(pgconn):