|
8 | 8 | from pandas.compat.numpy import np_version_under1p18
|
9 | 9 |
|
10 | 10 | import pandas as pd
|
11 |
| -from pandas import DatetimeIndex, Index, Period, PeriodIndex, TimedeltaIndex |
| 11 | +from pandas import DatetimeIndex, Period, PeriodIndex, TimedeltaIndex |
12 | 12 | import pandas._testing as tm
|
13 | 13 | from pandas.core.arrays import DatetimeArray, PandasArray, PeriodArray, TimedeltaArray
|
14 | 14 |
|
@@ -330,6 +330,19 @@ def test_searchsorted_castable_strings(self, arr1d, box, request):
|
330 | 330 | ):
|
331 | 331 | arr.searchsorted([str(arr[1]), "baz"])
|
332 | 332 |
|
| 333 | + def test_getitem_near_implementation_bounds(self): |
| 334 | + # We only check tz-naive for DTA bc the bounds are slightly different |
| 335 | + # for other tzs |
| 336 | + i8vals = np.asarray([NaT.value + n for n in range(1, 5)], dtype="i8") |
| 337 | + arr = self.array_cls(i8vals, freq="ns") |
| 338 | + arr[0] # should not raise OutOfBoundsDatetime |
| 339 | + |
| 340 | + index = pd.Index(arr) |
| 341 | + index[0] # should not raise OutOfBoundsDatetime |
| 342 | + |
| 343 | + ser = pd.Series(arr) |
| 344 | + ser[0] # should not raise OutOfBoundsDatetime |
| 345 | + |
333 | 346 | def test_getitem_2d(self, arr1d):
|
334 | 347 | # 2d slicing on a 1D array
|
335 | 348 | expected = type(arr1d)(arr1d._data[:, np.newaxis], dtype=arr1d.dtype)
|
@@ -403,7 +416,7 @@ def test_setitem(self):
|
403 | 416 | @pytest.mark.parametrize(
|
404 | 417 | "box",
|
405 | 418 | [
|
406 |
| - Index, |
| 419 | + pd.Index, |
407 | 420 | pd.Series,
|
408 | 421 | np.array,
|
409 | 422 | list,
|
|
0 commit comments