12
12
List ,
13
13
Tuple ,
14
14
)
15
- import warnings
16
15
17
16
import numpy as np
18
17
import pytest
@@ -566,6 +565,9 @@ def test_offsets_hashable(self, offset_types):
566
565
off = _create_offset (offset_types )
567
566
assert hash (off ) is not None
568
567
568
+ @pytest .mark .filterwarnings (
569
+ "ignore:Non-vectorized DateOffset being applied to Series or DatetimeIndex"
570
+ )
569
571
@pytest .mark .parametrize ("unit" , ["s" , "ms" , "us" ])
570
572
def test_add_dt64_ndarray_non_nano (self , offset_types , unit , request ):
571
573
# check that the result with non-nano matches nano
@@ -576,26 +578,15 @@ def test_add_dt64_ndarray_non_nano(self, offset_types, unit, request):
576
578
arr = dti ._data ._ndarray .astype (f"M8[{ unit } ]" )
577
579
dta = type (dti ._data )._simple_new (arr , dtype = arr .dtype )
578
580
579
- with warnings .catch_warnings (record = True ) as w :
580
- expected = dti ._data + off
581
- result = dta + off
581
+ expected = dti ._data + off
582
+ result = dta + off
582
583
583
584
exp_unit = unit
584
585
if isinstance (off , Tick ) and off ._creso > dta ._creso :
585
586
# cast to higher reso like we would with Timedelta scalar
586
587
exp_unit = Timedelta (off ).unit
587
588
expected = expected .as_unit (exp_unit )
588
589
589
- if len (w ):
590
- # PerformanceWarning was issued bc _apply_array raised, so we
591
- # fell back to object dtype, for which the code path does
592
- # not yet cast back to the original resolution
593
- mark = pytest .mark .xfail (
594
- reason = "Goes through object dtype in DatetimeArray._add_offset, "
595
- "doesn't restore reso in result"
596
- )
597
- request .node .add_marker (mark )
598
-
599
590
tm .assert_numpy_array_equal (result ._ndarray , expected ._ndarray )
600
591
601
592
0 commit comments