Skip to content

Commit bf05e07

Browse files
committed
Define strategy as function, not method
1 parent 12bbac0 commit bf05e07

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

pandas/tests/frame/test_apply.py

+15-14
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,20 @@ def zip_frames(frames, axis=1):
823823
return pd.DataFrame(zipped)
824824

825825

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+
826840
class TestDataFrameAggregate():
827841

828842
def test_agg_transform(self, axis, float_frame):
@@ -1142,20 +1156,7 @@ def test_agg_cython_table_raises(self, df, func, expected, axis):
11421156
with pytest.raises(expected):
11431157
df.agg(func, axis=axis)
11441158

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))
11591160
def test_frequency_is_original(self, index, num_columns):
11601161
# GH 22150
11611162
original = index.copy()

0 commit comments

Comments
 (0)