Skip to content

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

Merged
merged 70 commits into from
Sep 17, 2019
Merged

Conversation

WillAyd
Copy link
Member

@WillAyd WillAyd commented Aug 9, 2019

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

if orient in ("values", "records"):
expected = expected.reset_index(drop=True)
if orient != "split":
expected.name = None
Copy link
Member

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()
Copy link
Member

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?

),
# bad key
(
StringIO(
Copy link
Member

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?

Copy link
Member Author

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!

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"]])),
Copy link
Member

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

Copy link
Member Author

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

@jbrockmendel
Copy link
Member

@WillAyd a handful of comments, generally LGTM. This is going to be much nicer when you're done here, thanks for doing it.

@WillAyd
Copy link
Member Author

WillAyd commented Sep 17, 2019

OK last 3 commits should address outstanding comments. Let me know what you think and thanks again for the review

@jbrockmendel
Copy link
Member

@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.

@jbrockmendel jbrockmendel merged commit 54e9b75 into pandas-dev:master Sep 17, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
* 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
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
* 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
@WillAyd WillAyd deleted the json-parametrize branch January 16, 2020 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO JSON read_json, to_json, json_normalize Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants