Skip to content

Commit 7bc36c2

Browse files
committed
BUG: ensure consistent behavior of Index.is_all_dates (#19204) - improved tests, removed unnecessary imports
1 parent d298896 commit 7bc36c2

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

pandas/core/indexes/base.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from pandas._libs import algos as libalgos, index as libindex, lib
1010
import pandas._libs.join as libjoin
11-
from pandas._libs.lib import is_datetime_array, no_default
11+
from pandas._libs.lib import no_default
1212
from pandas._libs.tslibs import OutOfBoundsDatetime, Timestamp
1313
from pandas._libs.tslibs.period import IncompatibleFrequency
1414
from pandas._libs.tslibs.timezones import tz_compare
@@ -25,7 +25,6 @@
2525
from pandas.core.dtypes.common import (
2626
ensure_categorical,
2727
ensure_int64,
28-
ensure_object,
2928
ensure_platform_int,
3029
is_bool,
3130
is_bool_dtype,

pandas/tests/indexes/test_base.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1198,8 +1198,12 @@ def test_is_object(self, index, expected):
11981198
("bool", False),
11991199
("categorical", False),
12001200
("int", False),
1201-
("datetime", True),
12021201
("float", False),
1202+
("datetime", True),
1203+
("datetime-tz", True),
1204+
("period", True),
1205+
("timedelta", True),
1206+
("empty", False),
12031207
],
12041208
indirect=["index"],
12051209
)
@@ -1208,7 +1212,7 @@ def test_is_all_dates(self, index, expected):
12081212

12091213
@pytest.mark.parametrize(
12101214
"index",
1211-
["datetime", "datetime-tz", "period", "timedelta", "empty"],
1215+
["datetime", "datetime-tz", "period", "timedelta"],
12121216
indirect=["index"],
12131217
)
12141218
def test_is_all_dates_consistency(self, index):

0 commit comments

Comments
 (0)