@@ -524,7 +524,7 @@ def test_construction_dti_with_mixed_timezones(self):
524
524
Timestamp ("2011-01-01 10:00" , tz = "Asia/Tokyo" ),
525
525
Timestamp ("2011-01-02 10:00" , tz = "US/Eastern" ),
526
526
],
527
- dtype = "M8[s , US/Eastern]" ,
527
+ dtype = "M8[us , US/Eastern]" ,
528
528
name = "idx" ,
529
529
)
530
530
tm .assert_index_equal (dti , expected )
@@ -602,7 +602,7 @@ def test_constructor_coverage(self):
602
602
expected = DatetimeIndex (strings .astype ("O" ))
603
603
tm .assert_index_equal (result , expected )
604
604
605
- from_ints = DatetimeIndex (expected .as_unit ("ns" ).asi8 ).as_unit ("s " )
605
+ from_ints = DatetimeIndex (expected .as_unit ("ns" ).asi8 ).as_unit ("us " )
606
606
tm .assert_index_equal (from_ints , expected )
607
607
608
608
# string with NaT
@@ -611,7 +611,7 @@ def test_constructor_coverage(self):
611
611
expected = DatetimeIndex (strings .astype ("O" ))
612
612
tm .assert_index_equal (result , expected )
613
613
614
- from_ints = DatetimeIndex (expected .as_unit ("ns" ).asi8 ).as_unit ("s " )
614
+ from_ints = DatetimeIndex (expected .as_unit ("ns" ).asi8 ).as_unit ("us " )
615
615
tm .assert_index_equal (from_ints , expected )
616
616
617
617
# non-conforming
@@ -840,8 +840,8 @@ def test_construction_with_tz_and_tz_aware_dti(self):
840
840
841
841
def test_construction_with_nat_and_tzlocal (self ):
842
842
tz = dateutil .tz .tzlocal ()
843
- result = DatetimeIndex (["2018" , "NaT" ], tz = tz ). as_unit ( "ns" )
844
- expected = DatetimeIndex ([Timestamp ("2018" , tz = tz ), pd .NaT ]). as_unit ( "ns" )
843
+ result = DatetimeIndex (["2018" , "NaT" ], tz = tz )
844
+ expected = DatetimeIndex ([Timestamp ("2018" , tz = tz ), pd .NaT ])
845
845
tm .assert_index_equal (result , expected )
846
846
847
847
def test_constructor_with_ambiguous_keyword_arg (self ):
@@ -940,11 +940,11 @@ def test_dti_tz_constructors(self, tzstr):
940
940
941
941
idx1 = to_datetime (arr ).tz_localize (tzstr )
942
942
idx2 = date_range (
943
- start = "2005-11-10 08:00:00" , freq = "h" , periods = 2 , tz = tzstr , unit = "s "
943
+ start = "2005-11-10 08:00:00" , freq = "h" , periods = 2 , tz = tzstr , unit = "us "
944
944
)
945
945
idx2 = idx2 ._with_freq (None ) # the others all have freq=None
946
- idx3 = DatetimeIndex (arr , tz = tzstr ). as_unit ( "s" )
947
- idx4 = DatetimeIndex (np .array (arr ), tz = tzstr ). as_unit ( "s" )
946
+ idx3 = DatetimeIndex (arr , tz = tzstr )
947
+ idx4 = DatetimeIndex (np .array (arr ), tz = tzstr )
948
948
949
949
tm .assert_index_equal (idx1 , idx2 )
950
950
tm .assert_index_equal (idx1 , idx3 )
@@ -1211,9 +1211,9 @@ def test_dti_constructor_object_dtype_dayfirst_yearfirst_with_tz(self):
1211
1211
yfirst = Timestamp (2005 , 10 , 16 , tz = "US/Pacific" )
1212
1212
1213
1213
result1 = DatetimeIndex ([val ], tz = "US/Pacific" , dayfirst = True )
1214
- expected1 = DatetimeIndex ([dfirst ]). as_unit ( "s" )
1214
+ expected1 = DatetimeIndex ([dfirst ])
1215
1215
tm .assert_index_equal (result1 , expected1 )
1216
1216
1217
1217
result2 = DatetimeIndex ([val ], tz = "US/Pacific" , yearfirst = True )
1218
- expected2 = DatetimeIndex ([yfirst ]). as_unit ( "s" )
1218
+ expected2 = DatetimeIndex ([yfirst ])
1219
1219
tm .assert_index_equal (result2 , expected2 )
0 commit comments