Skip to content

Commit 1c6781d

Browse files
committed
Fix failing tests
1 parent a2175c0 commit 1c6781d

File tree

3 files changed

+18
-23
lines changed

3 files changed

+18
-23
lines changed

pandas/tests/io/json/test_json_table_schema_ext_dtype.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def test_build_decimal_series(self, dc):
159159
expected = OrderedDict(
160160
[
161161
("schema", schema),
162-
("data", [OrderedDict([("id", 0), ("a", 10.0)])]),
162+
("data", [OrderedDict([("id", 0), ("a", "10")])]),
163163
]
164164
)
165165

@@ -245,7 +245,7 @@ def test_to_json(self, da, dc, sa, ia):
245245
[
246246
("idx", 0),
247247
("A", "2021-10-10T00:00:00.000"),
248-
("B", 10.0),
248+
("B", "10"),
249249
("C", "pandas"),
250250
("D", 10),
251251
]

pandas/tests/io/json/test_pandas.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import datetime
22
from datetime import timedelta
3-
from decimal import Decimal
43
from io import StringIO
54
import json
65
import os
@@ -2025,12 +2024,8 @@ def test_to_s3(self, s3_public_bucket, s3so):
20252024
timeout -= 0.1
20262025
assert timeout > 0, "Timed out waiting for file to appear on moto"
20272026

2028-
def test_json_pandas_nulls(self, nulls_fixture, request):
2027+
def test_json_pandas_nulls(self, nulls_fixture):
20292028
# GH 31615
2030-
if isinstance(nulls_fixture, Decimal):
2031-
mark = pytest.mark.xfail(reason="not implemented")
2032-
request.applymarker(mark)
2033-
20342029
expected_warning = None
20352030
msg = (
20362031
"The default 'epoch' date format is deprecated and will be removed "

pandas/tests/io/json/test_ujson.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -57,56 +57,56 @@ def test_encode_decimal(self):
5757
sut = decimal.Decimal("1337.1337")
5858
encoded = ujson.ujson_dumps(sut, double_precision=15)
5959
decoded = ujson.ujson_loads(encoded)
60-
assert decoded == 1337.1337
60+
assert decoded == "1337.1337"
6161

6262
sut = decimal.Decimal("0.95")
6363
encoded = ujson.ujson_dumps(sut, double_precision=1)
64-
assert encoded == "1.0"
64+
assert encoded == '"0.95"'
6565

6666
decoded = ujson.ujson_loads(encoded)
67-
assert decoded == 1.0
67+
assert decoded == "0.95"
6868

6969
sut = decimal.Decimal("0.94")
7070
encoded = ujson.ujson_dumps(sut, double_precision=1)
71-
assert encoded == "0.9"
71+
assert encoded == '"0.94"'
7272

7373
decoded = ujson.ujson_loads(encoded)
74-
assert decoded == 0.9
74+
assert decoded == "0.94"
7575

7676
sut = decimal.Decimal("1.95")
7777
encoded = ujson.ujson_dumps(sut, double_precision=1)
78-
assert encoded == "2.0"
78+
assert encoded == '"1.95"'
7979

8080
decoded = ujson.ujson_loads(encoded)
81-
assert decoded == 2.0
81+
assert decoded == "1.95"
8282

8383
sut = decimal.Decimal("-1.95")
8484
encoded = ujson.ujson_dumps(sut, double_precision=1)
85-
assert encoded == "-2.0"
85+
assert encoded == '"-1.95"'
8686

8787
decoded = ujson.ujson_loads(encoded)
88-
assert decoded == -2.0
88+
assert decoded == "-1.95"
8989

9090
sut = decimal.Decimal("0.995")
9191
encoded = ujson.ujson_dumps(sut, double_precision=2)
92-
assert encoded == "1.0"
92+
assert encoded == '"0.995"'
9393

9494
decoded = ujson.ujson_loads(encoded)
95-
assert decoded == 1.0
95+
assert decoded == "0.995"
9696

9797
sut = decimal.Decimal("0.9995")
9898
encoded = ujson.ujson_dumps(sut, double_precision=3)
99-
assert encoded == "1.0"
99+
assert encoded == '"0.9995"'
100100

101101
decoded = ujson.ujson_loads(encoded)
102-
assert decoded == 1.0
102+
assert decoded == "0.9995"
103103

104104
sut = decimal.Decimal("0.99999999999999944")
105105
encoded = ujson.ujson_dumps(sut, double_precision=15)
106-
assert encoded == "1.0"
106+
assert encoded == '"0.99999999999999944"'
107107

108108
decoded = ujson.ujson_loads(encoded)
109-
assert decoded == 1.0
109+
assert decoded == "0.99999999999999944"
110110

111111
@pytest.mark.parametrize("ensure_ascii", [True, False])
112112
def test_encode_string_conversion(self, ensure_ascii):

0 commit comments

Comments
 (0)