Skip to content

TST: Split and simplify test_value_counts_unique_nunique #32281

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

@SaturnFromTitan SaturnFromTitan commented Feb 26, 2020

closes #32205, closes #32220

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

@SaturnFromTitan SaturnFromTitan changed the title 32205 simplify test value counts unique nunique null in pandas tests base test ops py TST: Split and simplify test_value_counts_unique_nunique in pandas/tests/base/test_ops.py Feb 26, 2020
@SaturnFromTitan SaturnFromTitan changed the title TST: Split and simplify test_value_counts_unique_nunique in pandas/tests/base/test_ops.py TST: Split and simplify test_value_counts_unique_nunique Feb 26, 2020
@SaturnFromTitan SaturnFromTitan force-pushed the 32205-simplify-test_value_counts_unique_nunique_null-in-pandas-tests-base-test_ops-py branch 2 times, most recently from 5a39679 to b3f6091 Compare February 27, 2020 07:29
@SaturnFromTitan
Copy link
Contributor Author

The failing CI is unrelated to these changes

@SaturnFromTitan SaturnFromTitan force-pushed the 32205-simplify-test_value_counts_unique_nunique_null-in-pandas-tests-base-test_ops-py branch from b3f6091 to e9e4489 Compare February 27, 2020 12:36
@jreback jreback added the Testing pandas testing functions or related to the test suite label Feb 27, 2020
@jreback jreback added this to the 1.1 milestone Feb 27, 2020
@SaturnFromTitan
Copy link
Contributor Author

@jreback merged master to resolve conflicts

result = obj.value_counts()
tm.assert_series_equal(result, expected_s)
assert result.index.name is None
@pytest.mark.parametrize("null_obj", [np.nan, None])
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 use nulls_fixture

Copy link
Contributor Author

@SaturnFromTitan SaturnFromTitan Mar 3, 2020

Choose a reason for hiding this comment

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

I tried using nulls_fixture and unique_nulls_fixture. Nearly all configurations break for pd.NaT and pd.NA though...

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, yeah we need to test these, can you create an issue. we will want to add these even if they need xfailing for now as there is no testing on them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

xref: #32437

klass = type(obj)
values = obj._ndarray_values
num_values = len(orig)
def test_nunique_null(self, null_obj, index_or_series_obj):
Copy link
Contributor

Choose a reason for hiding this comment

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

same

result = obj.value_counts()
tm.assert_series_equal(result, expected_s)
assert result.index.name is None
@pytest.mark.parametrize("null_obj", [np.nan, None])
Copy link
Contributor

Choose a reason for hiding this comment

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

ok, yeah we need to test these, can you create an issue. we will want to add these even if they need xfailing for now as there is no testing on them.

@jreback jreback merged commit 0d04683 into pandas-dev:master Mar 4, 2020
@jreback
Copy link
Contributor

jreback commented Mar 4, 2020

thanks @SaturnFromTitan

one other followup on this. I think we should split out the tests you just changed (e.g. unique, value_counts) into a test_unique.py module; happy to do this generally as well (though should be separate from a refactorting PR).

@SaturnFromTitan
Copy link
Contributor Author

Will do. I'll wait until #32311 is merged though as I think it should go into the test_uniques.py as well

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
2 participants