Skip to content

Commit 055dc96

Browse files
committed
Change Unit test
1 parent cf7d95c commit 055dc96

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

pandas/tests/io/json/test_pandas.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2314,16 +2314,13 @@ def test_large_number():
23142314

23152315

23162316
@pytest.mark.parametrize(
2317-
"dataframe, expected_json",
2317+
"df",
23182318
[
2319-
(DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]}), '{"A":"int64","B":"int64"}'),
2320-
(
2321-
DataFrame({"X": [1.1, 2.2], "Y": ["a", "b"]}),
2322-
'{"X":"float64","Y":"object"}',
2323-
),
2319+
DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]}),
2320+
DataFrame({"X": [1.1, 2.2], "Y": ["a", "b"]}),
23242321
],
23252322
)
2326-
def test_dtypes_to_json(dataframe: DataFrame, expected_json):
2327-
# GH 61170
2328-
dtypes_json = dataframe.dtypes.to_json()
2329-
assert json.loads(dtypes_json) == json.loads(expected_json)
2323+
def test_dtypes_to_json_consistency(df: DataFrame):
2324+
expected = df.dtypes.apply(str).to_json()
2325+
result = df.dtypes.to_json()
2326+
assert json.loads(result) == json.loads(expected)

0 commit comments

Comments
 (0)