Skip to content
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

Fixturize JSON tests #31191

Merged
merged 15 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pandas/tests/io/json/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ def test_series_roundtrip_simple(self, orient, numpy, string_series):
data = string_series.to_json(orient=orient)
result = pd.read_json(data, typ="series", orient=orient, numpy=numpy)

expected = string_series
if orient in ("values", "records"):
expected = expected.reset_index(drop=True)
if orient != "split":
Expand All @@ -636,6 +637,7 @@ def test_series_roundtrip_object(self, orient, numpy, dtype, object_series):
data, typ="series", orient=orient, numpy=numpy, dtype=dtype
)

expected = object_series
if orient in ("values", "records"):
expected = expected.reset_index(drop=True)
if orient != "split":
Expand All @@ -648,7 +650,7 @@ def test_series_roundtrip_empty(self, orient, numpy, empty_series):
data = empty_series.to_json(orient=orient)
result = pd.read_json(data, typ="series", orient=orient, numpy=numpy)

# TODO: see what causes inconsistency
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did this get resolved?

expected = empty_series
if orient in ("values", "records"):
expected = expected.reset_index(drop=True)
else:
Expand All @@ -661,6 +663,7 @@ def test_series_roundtrip_timeseries(self, orient, numpy, datetime_series):
data = datetime_series.to_json(orient=orient)
result = pd.read_json(data, typ="series", orient=orient, numpy=numpy)

expected = datetime_series
if orient in ("values", "records"):
expected = expected.reset_index(drop=True)
if orient != "split":
Expand Down
3 changes: 3 additions & 0 deletions pandas/tests/resample/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ def test_resample_count_empty_series(freq, empty_series_dti, resample_method):
else:
index = empty_series_dti.index._shallow_copy(freq=freq)
expected = pd.Series([], dtype="int64", index=index, name=empty_series_dti.name)
index = _asfreq_compat(empty_series_dti.index, freq)

expected = pd.Series([], dtype="int64", index=index, name=empty_series_dti.name)

tm.assert_series_equal(result, expected)

Expand Down