| 1 |
# This file is part of Hypothesis, which may be found at |
| 2 |
# https://github.com/HypothesisWorks/hypothesis/ |
| 3 |
# |
| 4 |
# Copyright the Hypothesis Authors. |
| 5 |
# Individual contributors are listed in AUTHORS.rst and the git log. |
| 6 |
# |
| 7 |
# This Source Code Form is subject to the terms of the Mozilla Public License, |
| 8 |
# v. 2.0. If a copy of the MPL was not distributed with this file, You can |
| 9 |
# obtain one at https://mozilla.org/MPL/2.0/. |
| 10 |
|
| 11 |
from pytest import raises |
| 12 |
|
| 13 |
from hypothesis import HealthCheck, Verbosity, given, settings, strategies as st |
| 14 |
|
| 15 |
from tests.common.utils import Why, no_shrink, xfail_on_crosshair |
| 16 |
|
| 17 |
|
| 18 |
@xfail_on_crosshair(Why.nested_given) |
| 19 |
def test_nesting_1(): |
| 20 |
@given(st.integers(0, 100)) |
| 21 |
@settings( |
| 22 |
max_examples=5, |
| 23 |
database=None, |
| 24 |
deadline=None, |
| 25 |
suppress_health_check=[HealthCheck.nested_given], |
| 26 |
) |
| 27 |
def test_blah(x): |
| 28 |
@given(st.integers()) |
| 29 |
@settings( |
| 30 |
max_examples=100, phases=no_shrink, database=None, verbosity=Verbosity.quiet |
| 31 |
) |
| 32 |
def test_nest(y): |
| 33 |
if y >= x: |
| 34 |
raise ValueError |
| 35 |
|
| 36 |
with raises(ValueError): |
| 37 |
test_nest() |
| 38 |
|
| 39 |
test_blah() |