Skip to content

Commit

Permalink
Maybe a test? [for review by DRMaccIver]
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed May 17, 2017
1 parent 32ab72a commit 310ebf7
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tests/cover/test_datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@

from flaky import flaky

from hypothesis import given, settings
from hypothesis import find, given, settings
from tests.common.debug import minimal
from hypothesis.strategies import dates, times, datetimes, timedeltas
from hypothesis.strategies import none, dates, times, binary, datetimes, \
timedeltas
from hypothesis.strategytests import strategy_test_suite
from hypothesis.internal.compat import hrange
from hypothesis.searchstrategy.datetime import DatetimeStrategy
from hypothesis.internal.conjecture.data import ConjectureData

TestStandardDescriptorFeatures_timedeltas1 = strategy_test_suite(timedeltas())

Expand Down Expand Up @@ -94,6 +97,17 @@ def test_single_datetime(val):
assert datetimes(val, val).example() is val


def test_DatetimeStrategy_draw_may_fail():
strat = DatetimeStrategy(dt.datetime.min, dt.datetime.max, none())
failure_inducing = find(
binary(),
lambda b: strat._attempt_one_draw(
ConjectureData.for_buffer(b)) is None
)
# Should raise some kind of error?
ConjectureData.for_buffer(failure_inducing * 100).draw(datetimes())


TestStandardDescriptorFeatures_dates1 = strategy_test_suite(dates())


Expand Down

0 comments on commit 310ebf7

Please sign in to comment.