Skip to content

REF: tests.indexes.numeric.py #41192

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 4 commits into from
Apr 30, 2021
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
16 changes: 10 additions & 6 deletions pandas/tests/indexes/categorical/test_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@


class TestCategoricalIndex(Base):
_holder = CategoricalIndex
_index_cls = CategoricalIndex

@pytest.fixture
def simple_index(self) -> CategoricalIndex:
return self._index_cls(list("aabbca"), categories=list("cab"), ordered=False)

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

def create_index(self, categories=None, ordered=False):
def create_index(self, *, categories=None, ordered=False):
if categories is None:
categories = list("cab")
return CategoricalIndex(list("aabbca"), categories=categories, ordered=ordered)
Expand All @@ -33,9 +37,9 @@ def test_can_hold_identifiers(self):
key = idx[0]
assert idx._can_hold_identifiers_and_holds_name(key) is True

def test_insert(self):
def test_insert(self, simple_index):

ci = self.create_index()
ci = simple_index
categories = ci.categories

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

def test_delete(self):
def test_delete(self, simple_index):

ci = self.create_index()
ci = simple_index
categories = ci.categories

result = ci.delete(0)
Expand Down
Loading