Skip to content

Commit 9146b73

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

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

pandas/tests/frame/test_apply.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,19 @@ def zip_frames(frames, axis=1):
822822
zipped = [f.loc[i, :] for i in index for f in frames]
823823
return pd.DataFrame(zipped)
824824

825+
@composite
826+
def indices(draw, max_length=5):
827+
date = draw(
828+
dates(
829+
min_value=Timestamp.min.ceil("D").to_pydatetime().date(),
830+
max_value=Timestamp.max.floor("D").to_pydatetime().date(),
831+
).map(Timestamp)
832+
)
833+
periods = draw(integers(0, max_length))
834+
freq = draw(sampled_from(list("BDHTS")))
835+
dr = date_range(date, periods=periods, freq=freq)
836+
return pd.DatetimeIndex(list(dr))
837+
825838

826839
class TestDataFrameAggregate():
827840

@@ -1142,20 +1155,7 @@ def test_agg_cython_table_raises(self, df, func, expected, axis):
11421155
with pytest.raises(expected):
11431156
df.agg(func, axis=axis)
11441157

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))
1158+
@given(index=indices(max_length=5), num_columns=integers(0, 5))
11591159
def test_frequency_is_original(self, index, num_columns):
11601160
# GH 22150
11611161
original = index.copy()

0 commit comments

Comments
 (0)