1010import numpy as np
1111import pytest
1212
13- from pandas .compat .numpy import _np_version_under1p18
14-
1513import pandas as pd
1614import pandas .util .testing as tm
1715
@@ -63,53 +61,54 @@ def test_cummax(self, datetime_series):
6361
6462 tm .assert_series_equal (result , expected )
6563
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 ):
7066 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 )
7270 )
7371
7472 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 )
7676 )
7777 result = s .cummin (skipna = True )
7878 tm .assert_series_equal (expected , result )
7979
8080 expected = pd .Series (
8181 pd .to_datetime (
8282 ["NaT" , "2000-1-2" , "2000-1-2" , "2000-1-1" , "2000-1-1" , "2000-1-1" ]
83- )
83+ ). tz_localize ( tz )
8484 )
8585 result = s .cummin (skipna = False )
8686 tm .assert_series_equal (expected , result )
8787
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 ):
9290 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 )
9494 )
9595
9696 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 )
98100 )
99101 result = s .cummax (skipna = True )
100102 tm .assert_series_equal (expected , result )
101103
102104 expected = pd .Series (
103105 pd .to_datetime (
104106 ["NaT" , "2000-1-2" , "2000-1-2" , "2000-1-2" , "2000-1-2" , "2000-1-3" ]
105- )
107+ ). tz_localize ( tz )
106108 )
107109 result = s .cummax (skipna = False )
108110 tm .assert_series_equal (expected , result )
109111
110- @pytest .mark .xfail (
111- not _np_version_under1p18 , reason = "numpy 1.18 changed min/max behavior for NaT"
112- )
113112 def test_cummin_timedelta64 (self ):
114113 s = pd .Series (pd .to_timedelta (["NaT" , "2 min" , "NaT" , "1 min" , "NaT" , "3 min" ]))
115114
@@ -125,9 +124,6 @@ def test_cummin_timedelta64(self):
125124 result = s .cummin (skipna = False )
126125 tm .assert_series_equal (expected , result )
127126
128- @pytest .mark .xfail (
129- not _np_version_under1p18 , reason = "numpy 1.18 changed min/max behavior for NaT"
130- )
131127 def test_cummax_timedelta64 (self ):
132128 s = pd .Series (pd .to_timedelta (["NaT" , "2 min" , "NaT" , "1 min" , "NaT" , "3 min" ]))
133129
0 commit comments