Skip to content

Commit 6df88c3

Browse files
SaturnFromTitanroberthdevries
authored andcommitted
Use fixtures in pandas/tests/base (pandas-dev#32046)
1 parent dcfb549 commit 6df88c3

File tree

3 files changed

+228
-200
lines changed

3 files changed

+228
-200
lines changed

pandas/conftest.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ def _gen_mi():
986986
"uint": tm.makeUIntIndex(100),
987987
"range": tm.makeRangeIndex(100),
988988
"float": tm.makeFloatIndex(100),
989-
"bool": tm.makeBoolIndex(2),
989+
"bool": tm.makeBoolIndex(10),
990990
"categorical": tm.makeCategoricalIndex(100),
991991
"interval": tm.makeIntervalIndex(100),
992992
"empty": Index([]),
@@ -998,6 +998,15 @@ def _gen_mi():
998998

999999
@pytest.fixture(params=indices_dict.keys())
10001000
def indices(request):
1001+
"""
1002+
Fixture for many "simple" kinds of indices.
1003+
1004+
These indices are unlikely to cover corner cases, e.g.
1005+
- no names
1006+
- no NaTs/NaNs
1007+
- no values near implementation bounds
1008+
- ...
1009+
"""
10011010
# copy to avoid mutation, e.g. setting .name
10021011
return indices_dict[request.param].copy()
10031012

@@ -1015,6 +1024,14 @@ def _create_series(index):
10151024
}
10161025

10171026

1027+
@pytest.fixture
1028+
def series_with_simple_index(indices):
1029+
"""
1030+
Fixture for tests on series with changing types of indices.
1031+
"""
1032+
return _create_series(indices)
1033+
1034+
10181035
_narrow_dtypes = [
10191036
np.float16,
10201037
np.float32,

0 commit comments

Comments
 (0)