@@ -823,6 +823,20 @@ def zip_frames(frames, axis=1):
823
823
return pd .DataFrame (zipped )
824
824
825
825
826
+ @composite
827
+ def indices (draw , max_length = 5 ):
828
+ date = draw (
829
+ dates (
830
+ min_value = Timestamp .min .ceil ("D" ).to_pydatetime ().date (),
831
+ max_value = Timestamp .max .floor ("D" ).to_pydatetime ().date (),
832
+ ).map (Timestamp )
833
+ )
834
+ periods = draw (integers (0 , max_length ))
835
+ freq = draw (sampled_from (list ("BDHTS" )))
836
+ dr = date_range (date , periods = periods , freq = freq )
837
+ return pd .DatetimeIndex (list (dr ))
838
+
839
+
826
840
class TestDataFrameAggregate ():
827
841
828
842
def test_agg_transform (self , axis , float_frame ):
@@ -1142,20 +1156,7 @@ def test_agg_cython_table_raises(self, df, func, expected, axis):
1142
1156
with pytest .raises (expected ):
1143
1157
df .agg (func , axis = axis )
1144
1158
1145
- @composite
1146
- def indices (draw , max_length = 5 ):
1147
- date = draw (
1148
- dates (
1149
- min_value = Timestamp .min .ceil ("D" ).to_pydatetime ().date (),
1150
- max_value = Timestamp .max .floor ("D" ).to_pydatetime ().date (),
1151
- ).map (Timestamp )
1152
- )
1153
- periods = draw (integers (0 , max_length ))
1154
- freq = draw (sampled_from (list ("BDHTS" )))
1155
- dr = date_range (date , periods = periods , freq = freq )
1156
- return pd .DatetimeIndex (list (dr ))
1157
-
1158
- @given (index = indices (5 ), num_columns = integers (0 , 5 ))
1159
+ @given (index = indices (max_length = 5 ), num_columns = integers (0 , 5 ))
1159
1160
def test_frequency_is_original (self , index , num_columns ):
1160
1161
# GH 22150
1161
1162
original = index .copy ()
0 commit comments