Skip to content

TST: Fix flakey hypothesis apply test #24307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 16, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 4 additions & 19 deletions pandas/tests/frame/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,20 +823,6 @@ def zip_frames(frames, axis=1):
return pd.DataFrame(zipped)


@composite
def indices(draw, max_length=5):
date = draw(
dates(
min_value=Timestamp.min.ceil("D").to_pydatetime().date(),
max_value=Timestamp.max.floor("D").to_pydatetime().date(),
).map(Timestamp)
)
periods = draw(integers(0, max_length))
freq = draw(sampled_from(list("BDHTS")))
dr = date_range(date, periods=periods, freq=freq)
return pd.DatetimeIndex(list(dr))


class TestDataFrameAggregate():

def test_agg_transform(self, axis, float_frame):
Expand Down Expand Up @@ -1156,11 +1142,10 @@ def test_agg_cython_table_raises(self, df, func, expected, axis):
with pytest.raises(expected):
df.agg(func, axis=axis)

@given(index=indices(max_length=5), num_columns=integers(0, 5))
@settings(deadline=1000)
def test_frequency_is_original(self, index, num_columns):
# GH 22150
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems the issue number got removed inadvertently.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake - added back here: #24313

@pytest.mark.parametrize("num_cols", [2, 3, 5])
def test_frequency_is_original(self, num_cols):
index = pd.DatetimeIndex(["1950-06-30", "1952-10-24", "1953-05-29"])
original = index.copy()
df = DataFrame(True, index=index, columns=range(num_columns))
df = DataFrame(1, index=index, columns=range(num_cols))
df.apply(lambda x: x)
assert index.freq == original.freq