Skip to content

TST: use custom parametrization for consistency in base extension array tests #44332

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

Conversation

jorisvandenbossche
Copy link
Member

Follow-up on #44242, as that broke geopandas CI. This adds back the custom parametrization, which also makes it consistent with the other occurrence of this test (for a different op) which is still using this:

@pytest.mark.parametrize("box", [pd.Series, pd.DataFrame])
def test_direct_arith_with_ndframe_returns_not_implemented(self, data, box):
# EAs should return NotImplemented for ops with Series/DataFrame
# Pandas takes care of unboxing the series and calling the EA's op.
other = pd.Series(data)
if box is pd.DataFrame:
other = other.to_frame()
if hasattr(data, "__add__"):
result = data.__add__(other)
assert result is NotImplemented
else:
raise pytest.skip(f"{type(data).__name__} does not implement add")

Since this is the only occurrence of frame_or_series in the base extension tests, I think it's not warranted to make it a fixture. If we would rather want this, we should add it to tests/extension/conftest.py instead (can always be done in a follow-up).

@jorisvandenbossche jorisvandenbossche added this to the 1.4 milestone Nov 6, 2021
@jorisvandenbossche jorisvandenbossche mentioned this pull request Nov 6, 2021
4 tasks
@jbrockmendel
Copy link
Member

we should add it to tests/extension/conftest.py

i dont understand. why would we duplicate the fixture already in the top-level conftest?

@jorisvandenbossche
Copy link
Member Author

why would we duplicate the fixture already in the top-level conftest?

Because it makes it clear what is expected to be implemented by the downstream user. In practice there are currently no duplicated fixtures though.

@jorisvandenbossche
Copy link
Member Author

Since this will fixup downstream CI + make this consistent within the same file, going to merge this. If we want to change the use of the fixture, we can do that in a later PR.

@jorisvandenbossche jorisvandenbossche merged commit 64fdfd1 into pandas-dev:master Nov 11, 2021
@jorisvandenbossche jorisvandenbossche deleted the test-ext-base-fixture branch November 11, 2021 20:10
nickleus27 pushed a commit to nickleus27/pandas that referenced this pull request Nov 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants