Skip to content

Commit 48c5224

Browse files
authored
REF: tests.indexes.numeric.py (#41192)
1 parent ebe54de commit 48c5224

File tree

10 files changed

+406
-350
lines changed

10 files changed

+406
-350
lines changed

pandas/tests/indexes/categorical/test_category.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@
1717

1818

1919
class TestCategoricalIndex(Base):
20-
_holder = CategoricalIndex
20+
_index_cls = CategoricalIndex
21+
22+
@pytest.fixture
23+
def simple_index(self) -> CategoricalIndex:
24+
return self._index_cls(list("aabbca"), categories=list("cab"), ordered=False)
2125

2226
@pytest.fixture
2327
def index(self, request):
2428
return tm.makeCategoricalIndex(100)
2529

26-
def create_index(self, categories=None, ordered=False):
30+
def create_index(self, *, categories=None, ordered=False):
2731
if categories is None:
2832
categories = list("cab")
2933
return CategoricalIndex(list("aabbca"), categories=categories, ordered=ordered)
@@ -33,9 +37,9 @@ def test_can_hold_identifiers(self):
3337
key = idx[0]
3438
assert idx._can_hold_identifiers_and_holds_name(key) is True
3539

36-
def test_insert(self):
40+
def test_insert(self, simple_index):
3741

38-
ci = self.create_index()
42+
ci = simple_index
3943
categories = ci.categories
4044

4145
# test 0th element
@@ -70,9 +74,9 @@ def test_insert_na_mismatched_dtype(self):
7074
expected = Index([pd.NaT, 0, 1, 1], dtype=object)
7175
tm.assert_index_equal(result, expected)
7276

73-
def test_delete(self):
77+
def test_delete(self, simple_index):
7478

75-
ci = self.create_index()
79+
ci = simple_index
7680
categories = ci.categories
7781

7882
result = ci.delete(0)

0 commit comments

Comments
 (0)