Skip to content

Commit

Permalink
Text fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Jan 8, 2023
1 parent f9f21de commit f2897ea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
6 changes: 5 additions & 1 deletion hypothesis-python/tests/cover/test_custom_reprs.py
Expand Up @@ -12,7 +12,7 @@

import pytest

from hypothesis import given, strategies as st
from hypothesis import given, settings, strategies as st


def test_includes_non_default_args_in_repr():
Expand Down Expand Up @@ -79,6 +79,7 @@ class Bar(Foo):

def test_reprs_as_created():
@given(st.builds(Foo), st.from_type(Bar), st.none().map(Foo))
@settings(print_blob=False)
def inner(foo, bar, baz):
assert baz.x is None
assert foo.x <= 0 or bar.x >= 0
Expand All @@ -97,6 +98,7 @@ def inner(foo, bar, baz):

def test_reprs_as_created_interactive():
@given(st.data())
@settings(print_blob=False)
def inner(data):
bar = data.draw(st.builds(Bar, st.just(10)))
assert not bar.x
Expand All @@ -123,6 +125,7 @@ def test_as_created_reprs_fallback_for_distinct_calls_same_obj():
# If we have *different* calls which return the *same* object, we skip our
# nice repr because it's unclear which one we should use.
@given(st.builds(some_foo), st.builds(some_foo, st.none()))
@settings(print_blob=False)
def inner(a, b):
assert a is not b

Expand All @@ -143,6 +146,7 @@ def test_reprs_as_created_consistent_calls_despite_indentation():
# If we have multiple calls which return the same object, we can print their
# nice repr even if varying indentation means that they'll come out different!
@given(strat, st.builds(Bar, strat))
@settings(print_blob=False)
def inner(a, b):
assert a == b

Expand Down
18 changes: 10 additions & 8 deletions hypothesis-python/tests/quality/test_discovery_ability.py
Expand Up @@ -23,6 +23,7 @@
import re

from hypothesis import HealthCheck, settings as Settings
from hypothesis.control import BuildContext
from hypothesis.errors import UnsatisfiedAssumption
from hypothesis.internal import reflection
from hypothesis.internal.conjecture.engine import ConjectureRunner
Expand Down Expand Up @@ -73,14 +74,15 @@ def _condition(x):
)

def test_function(data):
try:
value = data.draw(specifier)
except UnsatisfiedAssumption:
data.mark_invalid()
if not _condition(value):
data.mark_invalid()
if predicate(value):
data.mark_interesting()
with BuildContext(data):
try:
value = data.draw(specifier)
except UnsatisfiedAssumption:
data.mark_invalid()
if not _condition(value):
data.mark_invalid()
if predicate(value):
data.mark_interesting()

successes = 0
actual_runs = 0
Expand Down

0 comments on commit f2897ea

Please sign in to comment.