Skip to content

Commit 8d4f4c3

Browse files
alimcmaster1Pingviinituutti
authored andcommitted
TST: Fix flakey hypothesis apply test (pandas-dev#24307)
1 parent 9e529fe commit 8d4f4c3

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

pandas/tests/frame/test_apply.py

+4-21
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
import warnings
1313
import numpy as np
14-
from hypothesis import given, settings
15-
from hypothesis.strategies import composite, dates, integers, sampled_from
1614

1715
from pandas import (notna, DataFrame, Series, MultiIndex, date_range,
1816
Timestamp, compat)
@@ -823,20 +821,6 @@ def zip_frames(frames, axis=1):
823821
return pd.DataFrame(zipped)
824822

825823

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-
840824
class TestDataFrameAggregate():
841825

842826
def test_agg_transform(self, axis, float_frame):
@@ -1156,11 +1140,10 @@ def test_agg_cython_table_raises(self, df, func, expected, axis):
11561140
with pytest.raises(expected):
11571141
df.agg(func, axis=axis)
11581142

1159-
@given(index=indices(max_length=5), num_columns=integers(0, 5))
1160-
@settings(deadline=1000)
1161-
def test_frequency_is_original(self, index, num_columns):
1162-
# GH 22150
1143+
@pytest.mark.parametrize("num_cols", [2, 3, 5])
1144+
def test_frequency_is_original(self, num_cols):
1145+
index = pd.DatetimeIndex(["1950-06-30", "1952-10-24", "1953-05-29"])
11631146
original = index.copy()
1164-
df = DataFrame(True, index=index, columns=range(num_columns))
1147+
df = DataFrame(1, index=index, columns=range(num_cols))
11651148
df.apply(lambda x: x)
11661149
assert index.freq == original.freq

0 commit comments

Comments
 (0)