diff --git a/hypothesis-python/.coveragerc b/hypothesis-python/.coveragerc index 3252207ac5..4cd8a529e4 100644 --- a/hypothesis-python/.coveragerc +++ b/hypothesis-python/.coveragerc @@ -23,6 +23,5 @@ exclude_lines = except ModuleNotFoundError: if PYPY: if TYPE_CHECKING: + if sys\.version_info if "\w+" in sys\.modules: - assert all\(.+\) - if sys\.version_info\[:2\] [<=]= \(3, [789]\) diff --git a/hypothesis-python/docs/conf.py b/hypothesis-python/docs/conf.py index fb504079ef..5a1d3edacb 100644 --- a/hypothesis-python/docs/conf.py +++ b/hypothesis-python/docs/conf.py @@ -99,7 +99,7 @@ def setup(app): "numpy": ("https://numpy.org/doc/stable/", None), "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None), "pytest": ("https://docs.pytest.org/en/stable/", None), - "django": ("https://docs.djangoproject.com/en/stable/", None), + "django": ("https://django.readthedocs.io/en/stable/", None), "dateutil": ("https://dateutil.readthedocs.io/en/stable/", None), "redis": ("https://redis-py.readthedocs.io/en/stable/", None), "attrs": ("https://www.attrs.org/en/stable/", None), diff --git a/hypothesis-python/src/hypothesis/extra/ghostwriter.py b/hypothesis-python/src/hypothesis/extra/ghostwriter.py index 6b24549a44..00e454ec02 100644 --- a/hypothesis-python/src/hypothesis/extra/ghostwriter.py +++ b/hypothesis-python/src/hypothesis/extra/ghostwriter.py @@ -52,7 +52,7 @@ .. tip:: Using a light theme? Hypothesis respects `NO_COLOR `__ - and :envvar:`DJANGO_COLORS=light `. + and ``DJANGO_COLORS=light``. .. note:: diff --git a/hypothesis-python/src/hypothesis/utils/terminal.py b/hypothesis-python/src/hypothesis/utils/terminal.py index 6a6f410d6a..0932b4e4e0 100644 --- a/hypothesis-python/src/hypothesis/utils/terminal.py +++ b/hypothesis-python/src/hypothesis/utils/terminal.py @@ -19,8 +19,9 @@ def guess_background_color(): https://unix.stackexchange.com/questions/245378/ """ django_colors = os.getenv("DJANGO_COLORS") - if django_colors in ("light", "dark"): - return django_colors + for theme in ("light", "dark"): + if theme in django_colors.split(";"): + return theme # Guessing based on the $COLORFGBG environment variable try: fg, *_, bg = os.getenv("COLORFGBG").split(";") diff --git a/hypothesis-python/tests/quality/test_float_shrinking.py b/hypothesis-python/tests/quality/test_float_shrinking.py index 3e545dc427..20abed3f53 100644 --- a/hypothesis-python/tests/quality/test_float_shrinking.py +++ b/hypothesis-python/tests/quality/test_float_shrinking.py @@ -42,7 +42,10 @@ def test_can_shrink_in_variable_sized_context(n): @given(st.floats(min_value=0, allow_infinity=False, allow_nan=False)) @settings(deadline=None, suppress_health_check=HealthCheck.all()) def test_shrinks_downwards_to_integers(f): - g = minimal(st.floats(), lambda x: x >= f, settings(verbosity=Verbosity.quiet)) + g = minimal( + st.floats().filter(lambda x: x >= f), + settings=settings(verbosity=Verbosity.quiet, max_examples=10**6), + ) assert g == ceil(f) @@ -51,8 +54,7 @@ def test_shrinks_downwards_to_integers(f): @settings(deadline=None, suppress_health_check=HealthCheck.all(), max_examples=10) def test_shrinks_downwards_to_integers_when_fractional(b): g = minimal( - st.floats(), - lambda x: assume((0 < x < (2**53)) and int(x) != x) and x >= b, + st.floats().filter(lambda x: x > b and int(x) != x), settings=settings(verbosity=Verbosity.quiet, max_examples=10**6), ) assert g == b + 0.5