Skip to content

Commit 1ac7815

Browse files
TST: Adds test coverage for pd.read_json index type (#53242)
* TST: Added test coverage for pd.read_json index type * Update pandas/tests/io/json/test_pandas.py Co-authored-by: Matthew Roeschke <[email protected]> * add coverage for entire index and columns. * Update pandas/tests/io/json/test_pandas.py Co-authored-by: Matthew Roeschke <[email protected]> --------- Co-authored-by: Matthew Roeschke <[email protected]>
1 parent a2bb939 commit 1ac7815

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/io/json/test_pandas.py

+10
Original file line numberDiff line numberDiff line change
@@ -1398,6 +1398,16 @@ def test_read_json_table_dtype_raises(self, dtype):
13981398
with pytest.raises(ValueError, match=msg):
13991399
read_json(dfjson, orient="table", dtype=dtype)
14001400

1401+
@pytest.mark.parametrize("orient", ["index", "columns", "records", "values"])
1402+
def test_read_json_table_empty_axes_dtype(self, orient):
1403+
# GH28558
1404+
1405+
expected = DataFrame()
1406+
result = read_json("{}", orient=orient, convert_axes=True)
1407+
1408+
tm.assert_index_equal(result.index, expected.index)
1409+
tm.assert_index_equal(result.columns, expected.columns)
1410+
14011411
def test_read_json_table_convert_axes_raises(self):
14021412
# GH25433 GH25435
14031413
df = DataFrame([[1, 2], [3, 4]], index=[1.0, 2.0], columns=["1.", "2."])

0 commit comments

Comments
 (0)