Skip to content

Commit 6d11c3a

Browse files
committed
Update json test
1 parent 94deaba commit 6d11c3a

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

pandas/tests/io/json/test_pandas.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,11 +1566,8 @@ def test_from_json_to_json_table_dtypes(self):
15661566
result = read_json(StringIO(dfjson), orient="table")
15671567
tm.assert_frame_equal(result, expected)
15681568

1569-
# TODO: We are casting to string which coerces None to NaN before casting back
1570-
# to object, ending up with incorrect na values
1571-
@pytest.mark.xfail(using_string_dtype(), reason="incorrect na conversion")
15721569
@pytest.mark.parametrize("orient", ["split", "records", "index", "columns"])
1573-
def test_to_json_from_json_columns_dtypes(self, orient):
1570+
def test_to_json_from_json_columns_dtypes(self, orient, using_infer_string):
15741571
# GH21892 GH33205
15751572
expected = DataFrame.from_dict(
15761573
{
@@ -1591,6 +1588,11 @@ def test_to_json_from_json_columns_dtypes(self, orient):
15911588
with tm.assert_produces_warning(FutureWarning, match=msg):
15921589
dfjson = expected.to_json(orient=orient)
15931590

1591+
if using_infer_string:
1592+
# When this is read back in it is inferred to "str" dtype which
1593+
# uses NaN instead of None.
1594+
expected.loc[0, "Object"] = np.nan
1595+
15941596
result = read_json(
15951597
StringIO(dfjson),
15961598
orient=orient,
@@ -1849,11 +1851,11 @@ def test_to_json_indent(self, indent):
18491851

18501852
assert result == expected
18511853

1852-
@pytest.mark.skipif(
1853-
using_string_dtype(),
1854-
reason="Adjust expected when infer_string is default, no bug here, "
1855-
"just a complicated parametrization",
1856-
)
1854+
# @pytest.mark.skipif(
1855+
# using_string_dtype(),
1856+
# reason="Adjust expected when infer_string is default, no bug here, "
1857+
# "just a complicated parametrization",
1858+
# )
18571859
@pytest.mark.parametrize(
18581860
"orient,expected",
18591861
[

0 commit comments

Comments
 (0)