]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Added test to reproduce array bug found with random data
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 11 Jan 2021 15:04:11 +0000 (16:04 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 12 Jan 2021 15:16:34 +0000 (16:16 +0100)
tests/types/test_array.py

index 591901cfa6219005f80e35949d60a359c19895d2..9de51c14a213a2d6ff7c10414c17b60aeb5ee753 100644 (file)
@@ -139,3 +139,14 @@ def test_array_mixed_numbers(array, type):
     dumper = tx.get_dumper(array, Format.BINARY)
     dumper.dump(array)
     assert dumper.oid == builtins[type].array_oid
+
+
+@pytest.mark.xfail
+@pytest.mark.parametrize("fmt_in", [Format.BINARY])  # TODO: add Format.TEXT
+def test_empty_list_mix(conn, fmt_in):
+    ph = "%s" if fmt_in == Format.TEXT else "%b"
+    objs = list(range(3))
+    # pro tip: don't get confused with the types
+    f1, f2 = conn.execute(f"select {ph}, {ph}", (objs, [])).fetchone()
+    assert f1 == objs
+    assert f2 == []