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 3 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
2 changes: 1 addition & 1 deletion pandas/tests/indexes/categorical/test_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


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

@pytest.fixture
def index(self, request):
Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/indexes/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
class Base:
""" base class for index sub-class tests """

_holder: Type[Index]
_index_cls: Type[Index]

def create_index(self) -> Index:
raise NotImplementedError("Method not implemented")
Expand All @@ -45,7 +45,7 @@ def test_pickle_compat_construction(self):
r"__new__\(\) takes at least 2 arguments \(1 given\)"
)
with pytest.raises(TypeError, match=msg):
self._holder()
self._index_cls()

@pytest.mark.parametrize("name", [None, "new_name"])
def test_to_frame(self, name):
Expand Down Expand Up @@ -495,7 +495,7 @@ def test_format(self):

def test_format_empty(self):
# GH35712
empty_idx = self._holder([])
empty_idx = self._index_cls([])
assert empty_idx.format() == []
assert empty_idx.format(name=True) == [""]

Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/indexes/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ def test_view(self):
i = self.create_index()

i_view = i.view("i8")
result = self._holder(i)
result = self._index_cls(i)
tm.assert_index_equal(result, i)

i_view = i.view(self._holder)
result = self._holder(i)
i_view = i.view(self._index_cls)
result = self._index_cls(i)
tm.assert_index_equal(result, i_view)

def test_map_callable(self):
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/indexes/datetimes/test_datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class TestDatetimeIndex(DatetimeLike):
_holder = DatetimeIndex
_index_cls = DatetimeIndex

@pytest.fixture(
params=[tm.makeDateIndex(10), date_range("20130110", periods=10, freq="-1D")],
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/indexes/interval/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TestBase(Base):
in test_interval.py or the specific test file (e.g. test_astype.py)
"""

_holder = IntervalIndex
_index_cls = IntervalIndex

@pytest.fixture
def index(self):
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/indexes/period/test_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


class TestPeriodIndex(DatetimeLike):
_holder = PeriodIndex
_index_cls = PeriodIndex

@pytest.fixture(
params=[
Expand Down Expand Up @@ -357,7 +357,7 @@ def test_map(self):

def test_format_empty(self):
# GH35712
empty_idx = self._holder([], freq="A")
empty_idx = self._index_cls([], freq="A")
assert empty_idx.format() == []
assert empty_idx.format(name=True) == [""]

Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/indexes/ranges/test_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


class TestRangeIndex(Numeric):
_holder = RangeIndex
_index_cls = RangeIndex

@pytest.fixture(
params=[
Expand Down Expand Up @@ -506,7 +506,7 @@ def test_engineless_lookup(self):

def test_format_empty(self):
# GH35712
empty_idx = self._holder(0)
empty_idx = self._index_cls(0)
assert empty_idx.format() == []
assert empty_idx.format(name=True) == [""]

Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/indexes/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@


class TestIndex(Base):
_holder = Index
_index_cls = Index

def create_index(self) -> Index:
return Index(list("abcde"))
Expand Down Expand Up @@ -1415,7 +1415,7 @@ class TestMixedIntIndex(Base):
# Mostly the tests from common.py for which the results differ
# in py2 and py3 because ints and strings are uncomparable in py3
# (GH 13514)
_holder = Index
_index_cls = Index

@pytest.fixture(params=[[0, "a", 1, "b", 2, "c"]], ids=["mixedIndex"])
def index(self, request):
Expand Down
Loading