16
16
npy_unit_to_abbrev ,
17
17
tz_compare ,
18
18
)
19
- from pandas ._libs .tslibs .dtypes import NpyDatetimeUnit
20
19
21
20
from pandas .core .dtypes .dtypes import DatetimeTZDtype
22
21
@@ -34,15 +33,6 @@ def unit(self, request):
34
33
"""Fixture returning parametrized time units"""
35
34
return request .param
36
35
37
- @pytest .fixture
38
- def reso (self , unit ):
39
- """Fixture returning datetime resolution for a given time unit"""
40
- return {
41
- "s" : NpyDatetimeUnit .NPY_FR_s .value ,
42
- "ms" : NpyDatetimeUnit .NPY_FR_ms .value ,
43
- "us" : NpyDatetimeUnit .NPY_FR_us .value ,
44
- }[unit ]
45
-
46
36
@pytest .fixture
47
37
def dtype (self , unit , tz_naive_fixture ):
48
38
tz = tz_naive_fixture
@@ -71,19 +61,19 @@ def dta(self, dta_dti):
71
61
dta , dti = dta_dti
72
62
return dta
73
63
74
- def test_non_nano (self , unit , reso , dtype ):
64
+ def test_non_nano (self , unit , dtype ):
75
65
arr = np .arange (5 , dtype = np .int64 ).view (f"M8[{ unit } ]" )
76
66
dta = DatetimeArray ._simple_new (arr , dtype = dtype )
77
67
78
68
assert dta .dtype == dtype
79
- assert dta [0 ]._creso == reso
69
+ assert dta [0 ].unit == unit
80
70
assert tz_compare (dta .tz , dta [0 ].tz )
81
71
assert (dta [0 ] == dta [:1 ]).all ()
82
72
83
73
@pytest .mark .parametrize (
84
74
"field" , DatetimeArray ._field_ops + DatetimeArray ._bool_ops
85
75
)
86
- def test_fields (self , unit , reso , field , dtype , dta_dti ):
76
+ def test_fields (self , unit , field , dtype , dta_dti ):
87
77
dta , dti = dta_dti
88
78
89
79
assert (dti == dta ).all ()
@@ -166,7 +156,7 @@ def test_time_date(self, dta_dti, meth):
166
156
expected = getattr (dti , meth )
167
157
tm .assert_numpy_array_equal (result , expected )
168
158
169
- def test_format_native_types (self , unit , reso , dtype , dta_dti ):
159
+ def test_format_native_types (self , unit , dtype , dta_dti ):
170
160
# In this case we should get the same formatted values with our nano
171
161
# version dti._data as we do with the non-nano dta
172
162
dta , dti = dta_dti
0 commit comments