Skip to content

Commit

Permalink
More test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Dec 6, 2022
1 parent f325d51 commit 1e66958
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
3 changes: 1 addition & 2 deletions hypothesis-python/.coveragerc
Expand Up @@ -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]\)
2 changes: 1 addition & 1 deletion hypothesis-python/docs/conf.py
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/src/hypothesis/extra/ghostwriter.py
Expand Up @@ -52,7 +52,7 @@
.. tip::
Using a light theme? Hypothesis respects `NO_COLOR <https://no-color.org/>`__
and :envvar:`DJANGO_COLORS=light <django:DJANGO_COLORS>`.
and ``DJANGO_COLORS=light``.
.. note::
Expand Down
5 changes: 3 additions & 2 deletions hypothesis-python/src/hypothesis/utils/terminal.py
Expand Up @@ -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(";")
Expand Down
8 changes: 5 additions & 3 deletions hypothesis-python/tests/quality/test_float_shrinking.py
Expand Up @@ -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)


Expand All @@ -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

0 comments on commit 1e66958

Please sign in to comment.