10
10
import numpy as np
11
11
import pytest
12
12
13
- from pandas .compat .numpy import _np_version_under1p18
14
-
15
13
import pandas as pd
16
14
import pandas .util .testing as tm
17
15
@@ -63,53 +61,54 @@ def test_cummax(self, datetime_series):
63
61
64
62
tm .assert_series_equal (result , expected )
65
63
66
- @pytest .mark .xfail (
67
- not _np_version_under1p18 , reason = "numpy 1.18 changed min/max behavior for NaT"
68
- )
69
- def test_cummin_datetime64 (self ):
64
+ @pytest .mark .parametrize ("tz" , [None , "US/Pacific" ])
65
+ def test_cummin_datetime64 (self , tz ):
70
66
s = pd .Series (
71
- pd .to_datetime (["NaT" , "2000-1-2" , "NaT" , "2000-1-1" , "NaT" , "2000-1-3" ])
67
+ pd .to_datetime (
68
+ ["NaT" , "2000-1-2" , "NaT" , "2000-1-1" , "NaT" , "2000-1-3" ]
69
+ ).tz_localize (tz )
72
70
)
73
71
74
72
expected = pd .Series (
75
- pd .to_datetime (["NaT" , "2000-1-2" , "NaT" , "2000-1-1" , "NaT" , "2000-1-1" ])
73
+ pd .to_datetime (
74
+ ["NaT" , "2000-1-2" , "NaT" , "2000-1-1" , "NaT" , "2000-1-1" ]
75
+ ).tz_localize (tz )
76
76
)
77
77
result = s .cummin (skipna = True )
78
78
tm .assert_series_equal (expected , result )
79
79
80
80
expected = pd .Series (
81
81
pd .to_datetime (
82
82
["NaT" , "2000-1-2" , "2000-1-2" , "2000-1-1" , "2000-1-1" , "2000-1-1" ]
83
- )
83
+ ). tz_localize ( tz )
84
84
)
85
85
result = s .cummin (skipna = False )
86
86
tm .assert_series_equal (expected , result )
87
87
88
- @pytest .mark .xfail (
89
- not _np_version_under1p18 , reason = "numpy 1.18 changed min/max behavior for NaT"
90
- )
91
- def test_cummax_datetime64 (self ):
88
+ @pytest .mark .parametrize ("tz" , [None , "US/Pacific" ])
89
+ def test_cummax_datetime64 (self , tz ):
92
90
s = pd .Series (
93
- pd .to_datetime (["NaT" , "2000-1-2" , "NaT" , "2000-1-1" , "NaT" , "2000-1-3" ])
91
+ pd .to_datetime (
92
+ ["NaT" , "2000-1-2" , "NaT" , "2000-1-1" , "NaT" , "2000-1-3" ]
93
+ ).tz_localize (tz )
94
94
)
95
95
96
96
expected = pd .Series (
97
- pd .to_datetime (["NaT" , "2000-1-2" , "NaT" , "2000-1-2" , "NaT" , "2000-1-3" ])
97
+ pd .to_datetime (
98
+ ["NaT" , "2000-1-2" , "NaT" , "2000-1-2" , "NaT" , "2000-1-3" ]
99
+ ).tz_localize (tz )
98
100
)
99
101
result = s .cummax (skipna = True )
100
102
tm .assert_series_equal (expected , result )
101
103
102
104
expected = pd .Series (
103
105
pd .to_datetime (
104
106
["NaT" , "2000-1-2" , "2000-1-2" , "2000-1-2" , "2000-1-2" , "2000-1-3" ]
105
- )
107
+ ). tz_localize ( tz )
106
108
)
107
109
result = s .cummax (skipna = False )
108
110
tm .assert_series_equal (expected , result )
109
111
110
- @pytest .mark .xfail (
111
- not _np_version_under1p18 , reason = "numpy 1.18 changed min/max behavior for NaT"
112
- )
113
112
def test_cummin_timedelta64 (self ):
114
113
s = pd .Series (pd .to_timedelta (["NaT" , "2 min" , "NaT" , "1 min" , "NaT" , "3 min" ]))
115
114
@@ -125,9 +124,6 @@ def test_cummin_timedelta64(self):
125
124
result = s .cummin (skipna = False )
126
125
tm .assert_series_equal (expected , result )
127
126
128
- @pytest .mark .xfail (
129
- not _np_version_under1p18 , reason = "numpy 1.18 changed min/max behavior for NaT"
130
- )
131
127
def test_cummax_timedelta64 (self ):
132
128
s = pd .Series (pd .to_timedelta (["NaT" , "2 min" , "NaT" , "1 min" , "NaT" , "3 min" ]))
133
129
0 commit comments