@@ -522,6 +522,11 @@ def test_datetimeindex_accessors() -> None:
522
522
check (assert_type (i0 .month_name (), pd .Index ), pd .Index , str )
523
523
check (assert_type (i0 .day_name (), pd .Index ), pd .Index , str )
524
524
check (assert_type (i0 .is_normalized , bool ), bool )
525
+ check (assert_type (i0 .unit , str ), str )
526
+ check (assert_type (i0 .as_unit ("s" ), pd .DatetimeIndex ), pd .DatetimeIndex )
527
+ check (assert_type (i0 .as_unit ("ms" ), pd .DatetimeIndex ), pd .DatetimeIndex )
528
+ check (assert_type (i0 .as_unit ("us" ), pd .DatetimeIndex ), pd .DatetimeIndex )
529
+ check (assert_type (i0 .as_unit ("ns" ), pd .DatetimeIndex ), pd .DatetimeIndex )
525
530
526
531
527
532
def test_timedeltaindex_accessors () -> None :
@@ -542,6 +547,11 @@ def test_timedeltaindex_accessors() -> None:
542
547
assert_type (i0 .floor ("D" ), pd .TimedeltaIndex ), pd .TimedeltaIndex , pd .Timedelta
543
548
)
544
549
check (assert_type (i0 .ceil ("D" ), pd .TimedeltaIndex ), pd .TimedeltaIndex , pd .Timedelta )
550
+ check (assert_type (i0 .unit , str ), str )
551
+ check (assert_type (i0 .as_unit ("s" ), pd .TimedeltaIndex ), pd .TimedeltaIndex )
552
+ check (assert_type (i0 .as_unit ("ms" ), pd .TimedeltaIndex ), pd .TimedeltaIndex )
553
+ check (assert_type (i0 .as_unit ("us" ), pd .TimedeltaIndex ), pd .TimedeltaIndex )
554
+ check (assert_type (i0 .as_unit ("ns" ), pd .TimedeltaIndex ), pd .TimedeltaIndex )
545
555
546
556
547
557
def test_periodindex_accessors () -> None :
0 commit comments