]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Added xfailing tests to remember what is left to implement
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 5 Apr 2020 05:37:05 +0000 (17:37 +1200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 5 Apr 2020 05:37:05 +0000 (17:37 +1200)
tests/types/test_array.py
tests/types/test_numeric.py

index 136c9b306e7e79dd6d5d87cb5c33100d72a3afc2..3809cabdb4a0d05e8393e892468b086bf4e0e240 100644 (file)
@@ -124,3 +124,13 @@ def test_array_register(conn):
     cur.execute("select '{postgres=arwdDxt/postgres}'::aclitem[]")
     res = cur.fetchone()[0]
     assert res == ["postgres=arwdDxt/postgres"]
+
+
+@pytest.mark.xfail
+def test_array_mixed_numbers():
+    # TODO: must use the type accommodating the largest/highest precision
+    tx = Transformer()
+    ad = tx.adapt([1, 32767], Format.BINARY)
+    assert ad[1] == builtins["int2"].array_oid
+    ad = tx.adapt([1, 32768], Format.BINARY)
+    assert ad[1] == builtins["int4"].array_oid
index 1de3196f1dfa1562e2fd76250561ddc995fa0709..955c9382fdf50e885447ed022908b553a62a0228 100644 (file)
@@ -3,7 +3,7 @@ from math import isnan, isinf, exp
 
 import pytest
 
-from psycopg3.adapt import TypeCaster, Format
+from psycopg3.adapt import TypeCaster, Transformer, Format
 from psycopg3.types import builtins
 from psycopg3.types.numeric import cast_float
 
@@ -32,6 +32,13 @@ def test_adapt_int(conn, val, expr):
     assert cur.fetchone()[0]
 
 
+@pytest.mark.xfail
+def test_adapt_int_binary():
+    # TODO: int binary adaptation (must choose the fitting int2,4,8)
+    tx = Transformer()
+    tx.adapt(1, Format.BINARY)
+
+
 @pytest.mark.parametrize(
     "val, pgtype, want",
     [
@@ -113,6 +120,13 @@ def test_adapt_float_approx(conn, val, expr):
     assert cur.fetchone()[0]
 
 
+@pytest.mark.xfail
+def test_adapt_float_binary():
+    # TODO: float binary adaptation
+    tx = Transformer()
+    tx.adapt(1.0, Format.BINARY)
+
+
 @pytest.mark.parametrize(
     "val, pgtype, want",
     [
@@ -197,6 +211,21 @@ def test_roundtrip_numeric(conn, val):
         assert result == val
 
 
+@pytest.mark.xfail
+def test_adapt_numeric_binary():
+    # TODO: numeric binary adaptation
+    tx = Transformer()
+    tx.adapt(Decimal(1), Format.BINARY)
+
+
+@pytest.mark.xfail
+def test_cast_numeric_binary(conn):
+    # TODO: numeric binary casting
+    cur = conn.cursor(binary=True)
+    res = cur.execute("select 1::numeric").fetchone()[0]
+    assert res == Decimal(1)
+
+
 @pytest.mark.parametrize(
     "val",
     [