Skip to content

TST: Replace tm.all_index_generator with indices fixture #32886

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

Conversation

SaturnFromTitan
Copy link
Contributor

Inspired by #30999

  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff

@SaturnFromTitan SaturnFromTitan added Clean Testing pandas testing functions or related to the test suite labels Mar 21, 2020
@SaturnFromTitan
Copy link
Contributor Author

SaturnFromTitan commented Mar 21, 2020

Originally I wanted to implement

create the indices fixture using tm.all_index_generator as suggested by jbrockmendel in this comment

But then I realised that all places where tm.all_index_generator is used would benefit from using indices instead.

Copy link
Contributor Author

@SaturnFromTitan SaturnFromTitan left a comment

Choose a reason for hiding this comment

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

Added some comments to aid the review

@@ -240,17 +243,9 @@ def test_to_xarray_index_types(self, index):
tm.assert_series_equal(result.to_series(), s, check_index_type=False)

@td.skip_if_no("xarray", min_version="0.7.0")
def test_to_xarray(self):
def test_to_xarray_multiindex(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Potentially this could benefit from using the MultiIndex cases from indices. I didn't want to include it in this PR though

and isinstance(obj, pd.DataFrame)
):
# TODO: Seems to be bugged
pytest.xfail("This doesn't raise")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wasn't sure what to do here. Is this ok or should this be fixed? I added an xfail for now, but can create a follow-up issue

Copy link
Contributor

Choose a reason for hiding this comment

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

can you split this to a separate test for now (and just xfail the entire test; we can come back later and fix), but rather not add this code. also create an issue (and reference it here).

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

looks good generally, comment, ping ping on green.

and isinstance(obj, pd.DataFrame)
):
# TODO: Seems to be bugged
pytest.xfail("This doesn't raise")
Copy link
Contributor

Choose a reason for hiding this comment

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

can you split this to a separate test for now (and just xfail the entire test; we can come back later and fix), but rather not add this code. also create an issue (and reference it here).

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

comment on a test

@@ -261,3 +256,15 @@ def test_to_xarray(self):
tm.assert_almost_equal(list(result.coords.keys()), ["one", "two"])
assert isinstance(result, DataArray)
tm.assert_series_equal(result.to_series(), s)

@td.skip_if_no("xarray", min_version="0.7.0")
Copy link
Contributor

Choose a reason for hiding this comment

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

cc @jbrockmendel your test moving PR for xrray might need rebasing after this

Copy link
Contributor

Choose a reason for hiding this comment

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

actually i think we always have a > 0.7.0 xarary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can check that as a follow-up. There are more spots where this condition is used

@SaturnFromTitan
Copy link
Contributor Author

@jreback CI is green

@jreback jreback merged commit 73cf1b4 into pandas-dev:master Mar 22, 2020
@jreback
Copy link
Contributor

jreback commented Mar 22, 2020

thanks @SaturnFromTitan

SeeminSyed pushed a commit to CSCD01-team01/pandas that referenced this pull request Mar 22, 2020
jbrockmendel pushed a commit to jbrockmendel/pandas that referenced this pull request Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants