@@ -386,9 +386,11 @@ def test_interval_cmp():
386386
387387def test_timedelta_construction () -> None :
388388 check (assert_type (pd .Timedelta (1 , "W" ), pd .Timedelta ), pd .Timedelta )
389- check (assert_type (pd .Timedelta (1 , "w" ), pd .Timedelta ), pd .Timedelta )
389+ with pytest_warns_bounded (FutureWarning , "'w' is deprecated" , lower = "2.2.99" ):
390+ check (assert_type (pd .Timedelta (1 , "w" ), pd .Timedelta ), pd .Timedelta )
390391 check (assert_type (pd .Timedelta (1 , "D" ), pd .Timedelta ), pd .Timedelta )
391- check (assert_type (pd .Timedelta (1 , "d" ), pd .Timedelta ), pd .Timedelta )
392+ with pytest_warns_bounded (FutureWarning , "'d' is deprecated" , lower = "2.2.99" ):
393+ check (assert_type (pd .Timedelta (1 , "d" ), pd .Timedelta ), pd .Timedelta )
392394 check (assert_type (pd .Timedelta (1 , "days" ), pd .Timedelta ), pd .Timedelta )
393395 check (assert_type (pd .Timedelta (1 , "day" ), pd .Timedelta ), pd .Timedelta )
394396 check (assert_type (pd .Timedelta (1 , "hours" ), pd .Timedelta ), pd .Timedelta )
@@ -421,9 +423,11 @@ def test_timedelta_construction() -> None:
421423 check (assert_type (pd .Timedelta (1 , "nanosecond" ), pd .Timedelta ), pd .Timedelta )
422424
423425 check (assert_type (pd .Timedelta ("1 W" ), pd .Timedelta ), pd .Timedelta )
424- check (assert_type (pd .Timedelta ("1 w" ), pd .Timedelta ), pd .Timedelta )
426+ with pytest_warns_bounded (FutureWarning , "'w' is deprecated" , lower = "2.2.99" ):
427+ check (assert_type (pd .Timedelta ("1 w" ), pd .Timedelta ), pd .Timedelta )
425428 check (assert_type (pd .Timedelta ("1 D" ), pd .Timedelta ), pd .Timedelta )
426- check (assert_type (pd .Timedelta ("1 d" ), pd .Timedelta ), pd .Timedelta )
429+ with pytest_warns_bounded (FutureWarning , "'d' is deprecated" , lower = "2.2.99" ):
430+ check (assert_type (pd .Timedelta ("1 d" ), pd .Timedelta ), pd .Timedelta )
427431 check (assert_type (pd .Timedelta ("1 days" ), pd .Timedelta ), pd .Timedelta )
428432 check (assert_type (pd .Timedelta ("1 day" ), pd .Timedelta ), pd .Timedelta )
429433 check (assert_type (pd .Timedelta ("1 hours" ), pd .Timedelta ), pd .Timedelta )
@@ -1518,7 +1522,13 @@ def test_timestamp_misc_methods() -> None:
15181522 check (assert_type (ts2 .round ("1s" , ambiguous = False ), pd .Timestamp ), pd .Timestamp )
15191523 check (assert_type (ts2 .round ("1s" , ambiguous = "NaT" ), pd .Timestamp ), pd .Timestamp )
15201524
1521- with pytest_warns_bounded (FutureWarning , "'H' is deprecated " , lower = "2.1.99" ):
1525+ with pytest_warns_bounded (
1526+ FutureWarning ,
1527+ "'H' is deprecated " ,
1528+ lower = "2.1.99" ,
1529+ upper = "2.2.99" ,
1530+ upper_exception = ValueError ,
1531+ ):
15221532 check (
15231533 assert_type (ts2 .round ("2H" , nonexistent = "shift_forward" ), pd .Timestamp ),
15241534 pd .Timestamp ,
@@ -1553,7 +1563,13 @@ def test_timestamp_misc_methods() -> None:
15531563 check (assert_type (ts2 .ceil ("1s" , ambiguous = False ), pd .Timestamp ), pd .Timestamp )
15541564 check (assert_type (ts2 .ceil ("1s" , ambiguous = "NaT" ), pd .Timestamp ), pd .Timestamp )
15551565
1556- with pytest_warns_bounded (FutureWarning , "'H' is deprecated" , lower = "2.1.99" ):
1566+ with pytest_warns_bounded (
1567+ FutureWarning ,
1568+ "'H' is deprecated" ,
1569+ lower = "2.1.99" ,
1570+ upper = "2.2.99" ,
1571+ upper_exception = ValueError ,
1572+ ):
15571573 check (
15581574 assert_type (ts2 .ceil ("2H" , nonexistent = "shift_forward" ), pd .Timestamp ),
15591575 pd .Timestamp ,
@@ -1587,7 +1603,13 @@ def test_timestamp_misc_methods() -> None:
15871603 check (assert_type (ts2 .floor ("1s" , ambiguous = False ), pd .Timestamp ), pd .Timestamp )
15881604 check (assert_type (ts2 .floor ("1s" , ambiguous = "NaT" ), pd .Timestamp ), pd .Timestamp )
15891605
1590- with pytest_warns_bounded (FutureWarning , "'H' is deprecated" , lower = "2.1.99" ):
1606+ with pytest_warns_bounded (
1607+ FutureWarning ,
1608+ "'H' is deprecated" ,
1609+ lower = "2.1.99" ,
1610+ upper = "2.2.99" ,
1611+ upper_exception = ValueError ,
1612+ ):
15911613 check (
15921614 assert_type (ts2 .floor ("2H" , nonexistent = "shift_forward" ), pd .Timestamp ),
15931615 pd .Timestamp ,
0 commit comments