Skip to content

TST: add read_json test #GH32383 #33345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Apr 12, 2020
17 changes: 17 additions & 0 deletions pandas/tests/io/json/test_json_table_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,23 @@ def test_build_series(self):

assert result == expected

def test_read_json(self):
# GH32383
df = pd.DataFrame(
{
"_id": {"0": "0"},
"category": {"0": "Goods"},
"recommender_id": {"0": "3"},
"recommender_name_en": {"0": "Urata"},
"name_en": {"0": "Hakata Dolls Matsuo"},
}
)
df_json = df.to_json()
df_dict = json.loads(df_json)
result = pd.read_json(df_json)
expected = pd.DataFrame().from_dict(df_dict)
tm.assert_frame_equal(result, expected)

def test_to_json(self):
df = self.df.copy()
df.index.name = "idx"
Expand Down