Skip to content

Commit 8410f5c

Browse files
committed
Added tests for Decimal types
1 parent c60c10e commit 8410f5c

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

python/tests/test_value_converter.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ async def test_as_class(
147147
("MONEY", Money(99999999999999999), 99999999999999999),
148148
("MONEY", 99999999999999999, 99999999999999999),
149149
("NUMERIC(5, 2)", Decimal("120.12"), Decimal("120.12")),
150+
("NUMERIC(5, 2)", Decimal(120.123), Decimal("120.12")),
151+
("NUMERIC(5, 2)", Decimal(120), Decimal("120")),
152+
("NUMERIC(5, 3)", Decimal(12.123), Decimal("12.123")),
150153
("FLOAT4", Float32(32.12329864501953), 32.12329864501953),
151154
("FLOAT4", 32.12329864501953, 32.12329864501953),
152155
("FLOAT8", Float64(32.12329864501953), 32.12329864501953),
@@ -830,11 +833,37 @@ async def test_empty_array(
830833
NumericArray([Decimal("121.23"), Decimal("188.99")]),
831834
[Decimal("121.23"), Decimal("188.99")],
832835
),
836+
(
837+
"NUMERIC(5, 2) ARRAY",
838+
NumericArray([Decimal(121.123), Decimal(188.99)]),
839+
[
840+
Decimal(121.12).quantize(Decimal("100.00")),
841+
Decimal(188.99).quantize(Decimal("100.00")),
842+
],
843+
),
844+
(
845+
"NUMERIC(5, 2) ARRAY",
846+
NumericArray([Decimal(121), Decimal(188)]),
847+
[Decimal(121), Decimal(188)],
848+
),
833849
(
834850
"NUMERIC(5, 2) ARRAY",
835851
NumericArray([[Decimal("121.23")], [Decimal("188.99")]]),
836852
[[Decimal("121.23")], [Decimal("188.99")]],
837853
),
854+
(
855+
"NUMERIC(5, 2) ARRAY",
856+
NumericArray([[Decimal(121.123)], [Decimal(188.99)]]),
857+
[
858+
[Decimal(121.12).quantize(Decimal("100.00"))],
859+
[Decimal(188.99).quantize(Decimal("100.00"))],
860+
],
861+
),
862+
(
863+
"NUMERIC(5, 2) ARRAY",
864+
NumericArray([[Decimal(121)], [Decimal(188)]]),
865+
[[Decimal(121)], [Decimal(188)]],
866+
),
838867
("FLOAT4 ARRAY", [], []),
839868
(
840869
"FLOAT4 ARRAY",

0 commit comments

Comments
 (0)