-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Parametrize JSON tests #27838
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
Parametrize JSON tests #27838
Conversation
if orient in ("values", "records"): | ||
expected = expected.reset_index(drop=True) | ||
if orient != "split": | ||
expected.name = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L837-L842 looks like it is the same as L810-L815, and really similar to 852-858, 883-884, possibly others. I guess this is what _check_orient used to be?
If this can be shared, that would be helpful. If not, comments to the effect of # this case does foo unlike in test_bar because of baz
if dtype is False: | ||
expected = dtSeries.copy() | ||
else: | ||
expected = self.objSeries.copy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L832-L835 look different from the existing logic in _check_version. am i missing soemthing?
pandas/tests/io/json/test_pandas.py
Outdated
), | ||
# bad key | ||
( | ||
StringIO( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can/should the StringIO calls go inside the test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea I think that would make it more readable - nice idea!
pandas/tests/io/json/test_pandas.py
Outdated
DataFrame([["a", "b"], ["c", "d"]], index=[1, 1], columns=["x", "y"]), | ||
), | ||
("records", DataFrame([["a", "b"], ["c", "d"]], columns=["x", "y"])), | ||
("values", DataFrame([["a", "b"], ["c", "d"]])), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would these be clearer if they conditionally did reset_index/columns in the test method to match the behavior in other tests? fine by me either way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No yea this is also a great idea - would match the pattern in other tests better for sure
@WillAyd a handful of comments, generally LGTM. This is going to be much nicer when you're done here, thanks for doing it. |
OK last 3 commits should address outstanding comments. Let me know what you think and thanks again for the review |
@WillAyd LGTM, thanks. There are a couple of threads in the diff that are unresolved that would make for nice follow-ups, but nothing that is a blocker. Merging. |
* Parametrized non unique column test * Parametrized non-unique index tests * Removed skip for values test * Blackify * Parametrized doubled_encoded_labels test * Parametrized 'biggie' test case * Parametrized basic test * simplified test names * int case * Parametrized categorical case * Parametrized empty test case * parametrized ts data * Parametrized mixed case * Removed unnecessary test * Blackify * moved position of dtype parametrization * Parametrized bad_data_raises test * broke off infinity test * parametrized precision test * parametrized infer words * Renamed df_orient to just orient for reuse * parametrized basic series test * Added default orient test * Parametrized empty series test * Parametrized series timeseries test * parametrized series numeric case * Removed unnecessary series roundtrip test * Parametrized date unit test * Parametrized utc test * parametrized ts_range_utc test * Removed py2 compat code * blackify * Parametrized infinity test * parametrized missing data test * Blackify * flake fixup * Comment cleanup * Fix up astypes * Py35 compat * 32 bit compat * PY35 compat * lint fixup * Revert Py35 compat * 32 bit compat restriction * PY35 columns orient sorting * Added missing import * More Py35 compat * Final Py35 compat (hopefully) * Final Py35 compat (hopefully) redux * Windows int fix * Invoke func * 32 bit compat fix * more 32 bit compat * Excepted split from int dtype check * Removed windows compat * Windows test compat * Fixed conftest docstring * Added TODO * Reverted changes to test_frame_from_json_to_json * Removed unused import * Added comment for nanosecond -> ms conversion * Removed duplicate StringIO usage * Used more standard approach for various expected outputs * removed numeric underscores
* Parametrized non unique column test * Parametrized non-unique index tests * Removed skip for values test * Blackify * Parametrized doubled_encoded_labels test * Parametrized 'biggie' test case * Parametrized basic test * simplified test names * int case * Parametrized categorical case * Parametrized empty test case * parametrized ts data * Parametrized mixed case * Removed unnecessary test * Blackify * moved position of dtype parametrization * Parametrized bad_data_raises test * broke off infinity test * parametrized precision test * parametrized infer words * Renamed df_orient to just orient for reuse * parametrized basic series test * Added default orient test * Parametrized empty series test * Parametrized series timeseries test * parametrized series numeric case * Removed unnecessary series roundtrip test * Parametrized date unit test * Parametrized utc test * parametrized ts_range_utc test * Removed py2 compat code * blackify * Parametrized infinity test * parametrized missing data test * Blackify * flake fixup * Comment cleanup * Fix up astypes * Py35 compat * 32 bit compat * PY35 compat * lint fixup * Revert Py35 compat * 32 bit compat restriction * PY35 columns orient sorting * Added missing import * More Py35 compat * Final Py35 compat (hopefully) * Final Py35 compat (hopefully) redux * Windows int fix * Invoke func * 32 bit compat fix * more 32 bit compat * Excepted split from int dtype check * Removed windows compat * Windows test compat * Fixed conftest docstring * Added TODO * Reverted changes to test_frame_from_json_to_json * Removed unused import * Added comment for nanosecond -> ms conversion * Removed duplicate StringIO usage * Used more standard approach for various expected outputs * removed numeric underscores
lot more to be done here but split these up as some of the large functions are difficult to highlight failures while working on extension module. Improved coverage and identified some inconsistencies in process (marked with TODOs) which can be tackled as follow ups