Skip to content

Commit

Permalink
TST: Fix flakey hypothesis apply test (pandas-dev#24307)
Browse files Browse the repository at this point in the history
  • Loading branch information
alimcmaster1 authored and jreback committed Dec 16, 2018
1 parent 6c767c5 commit 6643a97
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions pandas/tests/frame/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

import warnings
import numpy as np
from hypothesis import given, settings
from hypothesis.strategies import composite, dates, integers, sampled_from

from pandas import (notna, DataFrame, Series, MultiIndex, date_range,
Timestamp, compat)
Expand Down Expand Up @@ -823,20 +821,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 +1140,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
@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

0 comments on commit 6643a97

Please sign in to comment.