From: Daniele Varrazzo Date: Sun, 5 Apr 2020 05:37:05 +0000 (+1200) Subject: Added xfailing tests to remember what is left to implement X-Git-Tag: 3.0.dev0~604 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e1600b69fb07af88a804d5a070f74154f697016;p=thirdparty%2Fpsycopg.git Added xfailing tests to remember what is left to implement --- diff --git a/tests/types/test_array.py b/tests/types/test_array.py index 136c9b306..3809cabdb 100644 --- a/tests/types/test_array.py +++ b/tests/types/test_array.py @@ -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 diff --git a/tests/types/test_numeric.py b/tests/types/test_numeric.py index 1de3196f1..955c9382f 100644 --- a/tests/types/test_numeric.py +++ b/tests/types/test_numeric.py @@ -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", [