8
8
import pandas as pd
9
9
import pandas ._testing as tm
10
10
from pandas .core .arrays import DatetimeArray
11
- from pandas .core .arrays .datetimes import _sequence_to_dt64ns
12
11
13
12
14
13
class TestDatetimeArrayConstructor :
@@ -44,7 +43,6 @@ def test_freq_validation(self):
44
43
"meth" ,
45
44
[
46
45
DatetimeArray ._from_sequence ,
47
- _sequence_to_dt64ns ,
48
46
pd .to_datetime ,
49
47
pd .DatetimeIndex ,
50
48
],
@@ -104,9 +102,6 @@ def test_bool_dtype_raises(self):
104
102
with pytest .raises (TypeError , match = msg ):
105
103
DatetimeArray ._from_sequence (arr )
106
104
107
- with pytest .raises (TypeError , match = msg ):
108
- _sequence_to_dt64ns (arr )
109
-
110
105
with pytest .raises (TypeError , match = msg ):
111
106
pd .DatetimeIndex (arr )
112
107
@@ -143,14 +138,12 @@ def test_tz_dtype_mismatch_raises(self):
143
138
["2000" ], dtype = DatetimeTZDtype (tz = "US/Central" )
144
139
)
145
140
with pytest .raises (TypeError , match = "data is already tz-aware" ):
146
- DatetimeArray ._from_sequence_not_strict (
147
- arr , dtype = DatetimeTZDtype (tz = "UTC" )
148
- )
141
+ DatetimeArray ._from_sequence (arr , dtype = DatetimeTZDtype (tz = "UTC" ))
149
142
150
143
def test_tz_dtype_matches (self ):
151
144
dtype = DatetimeTZDtype (tz = "US/Central" )
152
145
arr = DatetimeArray ._from_sequence (["2000" ], dtype = dtype )
153
- result = DatetimeArray ._from_sequence_not_strict (arr , dtype = dtype )
146
+ result = DatetimeArray ._from_sequence (arr , dtype = dtype )
154
147
tm .assert_equal (arr , result )
155
148
156
149
@pytest .mark .parametrize ("order" , ["F" , "C" ])
@@ -160,13 +153,6 @@ def test_2d(self, order):
160
153
if order == "F" :
161
154
arr = arr .T
162
155
163
- res = _sequence_to_dt64ns (arr )
164
- expected = _sequence_to_dt64ns (arr .ravel ())
165
-
166
- tm .assert_numpy_array_equal (res [0 ].ravel (), expected [0 ])
167
- assert res [1 ] == expected [1 ]
168
- assert res [2 ] == expected [2 ]
169
-
170
156
res = DatetimeArray ._from_sequence (arr )
171
157
expected = DatetimeArray ._from_sequence (arr .ravel ()).reshape (arr .shape )
172
158
tm .assert_datetime_array_equal (res , expected )
0 commit comments