Skip to content

Use fixtures in pandas/tests/base #32046

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 7 commits into from
Feb 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion pandas/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ def __len__(self):
"uint": tm.makeUIntIndex(100),
"range": tm.makeRangeIndex(100),
"float": tm.makeFloatIndex(100),
"bool": tm.makeBoolIndex(2),
"bool": tm.makeBoolIndex(10),
"categorical": tm.makeCategoricalIndex(100),
"interval": tm.makeIntervalIndex(100),
"empty": Index([]),
Expand All @@ -978,6 +978,15 @@ def __len__(self):

@pytest.fixture(params=indices_dict.keys())
def indices(request):
"""
Fixture for many "simple" kinds of indices.

These indices are unlikely to cover corner cases, e.g.
- no names
- no NaTs/NaNs
- no values near implementation bounds
- ...
"""
# copy to avoid mutation, e.g. setting .name
return indices_dict[request.param].copy()

Expand All @@ -995,6 +1004,14 @@ def _create_series(index):
}


@pytest.fixture
def series_with_simple_index(indices):
"""
Fixture for tests on series with changing types of indices.
"""
return _create_series(indices)


_narrow_dtypes = [
np.float16,
np.float32,
Expand Down
Loading