Skip to content

Commit

Permalink
Merge pull request #3724 from HypothesisWorks/create-pull-request/patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD authored Aug 28, 2023
2 parents 4e675de + 1ccd8b1 commit b0335aa
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 27 deletions.
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ if [ -n "${GITHUB_ACTIONS-}" ] || [ -n "${CODESPACES-}" ] ; then
else
# Otherwise, we install it from scratch
# NOTE: tooling keeps this version in sync with ci_version in tooling
"$SCRIPTS/ensure-python.sh" 3.10.12
PYTHON=$(pythonloc 3.10.12)/bin/python
"$SCRIPTS/ensure-python.sh" 3.10.13
PYTHON=$(pythonloc 3.10.13)/bin/python
fi

TOOL_REQUIREMENTS="$ROOT/requirements/tools.txt"
Expand Down
3 changes: 3 additions & 0 deletions hypothesis-python/RELEASE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
RELEASE_TYPE: patch

This patch updates our autoformatting tools, improving our code style without any API changes.
8 changes: 8 additions & 0 deletions hypothesis-python/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ def setup(app):
if root.joinpath("RELEASE.rst").is_file():
app.tags.add("has_release_file")

# Workaround for partial-initialization problem when autodoc imports libcst
import libcst

import hypothesis.extra.codemods

assert libcst
assert hypothesis.extra.codemods

# patch in mock array_api namespace so we can autodoc it
from hypothesis.extra.array_api import (
RELEASED_VERSIONS,
Expand Down
13 changes: 8 additions & 5 deletions hypothesis-python/src/hypothesis/strategies/_internal/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def lists(
elements = SampledFromStrategy(
sorted(range(elements.start, elements.end + 1), key=abs)
if elements.end < 0 or elements.start > 0
else list(range(0, elements.end + 1))
else list(range(elements.end + 1))
+ list(range(-1, elements.start - 1, -1))
)

Expand Down Expand Up @@ -779,6 +779,9 @@ def randoms(
would occur with very low probability when it is set to True, and this
flag should only be set to True when your code relies on the distribution
of values for correctness.
For managing global state, see the :func:`~hypothesis.strategies.random_module`
strategy and :func:`~hypothesis.register_random` function.
"""
check_type(bool, note_method_calls, "note_method_calls")
check_type(bool, use_true_random, "use_true_random")
Expand Down Expand Up @@ -814,16 +817,16 @@ def do_draw(self, data):
@cacheable
@defines_strategy()
def random_module() -> SearchStrategy[RandomSeeder]:
"""The Hypothesis engine handles PRNG state for the stdlib and Numpy random
modules internally, always seeding them to zero and restoring the previous
state after the test.
"""Hypothesis always seeds global PRNGs before running a test, and restores the
previous state afterwards.
If having a fixed seed would unacceptably weaken your tests, and you
cannot use a ``random.Random`` instance provided by
:func:`~hypothesis.strategies.randoms`, this strategy calls
:func:`python:random.seed` with an arbitrary integer and passes you
an opaque object whose repr displays the seed value for debugging.
If ``numpy.random`` is available, that state is also managed.
If ``numpy.random`` is available, that state is also managed, as is anything
managed by :func:`hypothesis.register_random`.
Examples from these strategy shrink to seeds closer to zero.
"""
Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/tests/conjecture/test_float_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from hypothesis.internal.conjecture.engine import ConjectureRunner
from hypothesis.internal.floats import float_to_int

EXPONENTS = list(range(0, flt.MAX_EXPONENT + 1))
EXPONENTS = list(range(flt.MAX_EXPONENT + 1))
assert len(EXPONENTS) == 2**11


Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/tests/cover/test_regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def unicode_regex(pattern):
def _test_matching_pattern(pattern, *, isvalidchar, is_unicode=False):
r = unicode_regex(pattern) if is_unicode else ascii_regex(pattern)

codepoints = range(0, sys.maxunicode + 1) if is_unicode else range(1, 128)
codepoints = range(sys.maxunicode + 1) if is_unicode else range(1, 128)
for c in [chr(x) for x in codepoints]:
if isvalidchar(c):
msg = "%r supposed to match %r (%r, category %r), but it doesn't"
Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/tests/nocover/test_filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_is_filtered(x):
st.integers(1, 20),
st.integers(0, 19).map(lambda x: x + 1),
st.sampled_from(range(1, 21)),
st.sampled_from(range(0, 20)).map(lambda x: x + 1),
st.sampled_from(range(20)).map(lambda x: x + 1),
]


Expand Down
2 changes: 1 addition & 1 deletion requirements/coverage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pexpect==4.8.0
# via -r requirements/test.in
platformdirs==3.10.0
# via black
pluggy==1.2.0
pluggy==1.3.0
# via pytest
ptyprocess==0.7.0
# via pexpect
Expand Down
4 changes: 2 additions & 2 deletions requirements/fuzzing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ flask==2.2.5
# via dash
hypofuzz==23.7.1
# via -r requirements/fuzzing.in
hypothesis[cli]==6.82.5
hypothesis[cli]==6.82.6
# via hypofuzz
idna==3.4
# via requests
Expand Down Expand Up @@ -105,7 +105,7 @@ platformdirs==3.10.0
# via black
plotly==5.16.1
# via dash
pluggy==1.2.0
pluggy==1.3.0
# via pytest
psutil==5.9.5
# via hypofuzz
Expand Down
2 changes: 1 addition & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ packaging==23.1
# via pytest
pexpect==4.8.0
# via -r requirements/test.in
pluggy==1.2.0
pluggy==1.3.0
# via pytest
ptyprocess==0.7.0
# via pexpect
Expand Down
18 changes: 9 additions & 9 deletions requirements/tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ platformdirs==3.10.0
# black
# tox
# virtualenv
pluggy==1.2.0
pluggy==1.3.0
# via
# pytest
# tox
Expand All @@ -177,7 +177,7 @@ pyproject-api==1.5.4
# via tox
pyproject-hooks==1.0.0
# via build
pyright==1.1.323
pyright==1.1.324
# via -r requirements/tools.in
pytest==7.4.0
# via -r requirements/tools.in
Expand All @@ -203,7 +203,7 @@ rfc3986==2.0.0
# via twine
rich==13.5.2
# via twine
ruff==0.0.285
ruff==0.0.286
# via -r requirements/tools.in
secretstorage==3.3.3
# via keyring
Expand All @@ -220,7 +220,7 @@ sortedcontainers==2.4.0
# via hypothesis (hypothesis-python/setup.py)
soupsieve==2.4.1
# via beautifulsoup4
sphinx==6.2.1
sphinx==7.2.3
# via
# -r requirements/tools.in
# sphinx-codeautolink
Expand All @@ -236,7 +236,7 @@ sphinx-codeautolink==0.15.0
# via -r requirements/tools.in
sphinx-hoverxref==1.3.0
# via -r requirements/tools.in
sphinx-rtd-theme==1.2.2
sphinx-rtd-theme==1.3.0
# via -r requirements/tools.in
sphinx-selective-exclude==1.0.3
# via -r requirements/tools.in
Expand All @@ -254,7 +254,7 @@ sphinxcontrib-jsmath==1.0.1
# via sphinx
sphinxcontrib-qthelp==1.0.6
# via sphinx
sphinxcontrib-serializinghtml==1.1.8
sphinxcontrib-serializinghtml==1.1.9
# via sphinx
sqlparse==0.4.4
# via django
Expand All @@ -273,7 +273,7 @@ tomli==2.0.1
# pyproject-hooks
# pytest
# tox
tox==4.9.0
tox==4.10.0
# via -r requirements/tools.in
traitlets==5.9.0
# via
Expand All @@ -289,7 +289,7 @@ types-pyopenssl==23.2.0.2
# via types-redis
types-pytz==2023.3.0.1
# via -r requirements/tools.in
types-redis==4.6.0.4
types-redis==4.6.0.5
# via -r requirements/tools.in
typing-extensions==4.7.1
# via
Expand All @@ -310,7 +310,7 @@ wcwidth==0.2.6
# via prompt-toolkit
webencodings==0.5.1
# via bleach
wheel==0.41.1
wheel==0.41.2
# via pip-tools
zipp==3.16.2
# via importlib-metadata
Expand Down
8 changes: 4 additions & 4 deletions tooling/src/hypothesistooling/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,10 @@ def run_tox(task, version, *args):
# When a version is added or removed, manually update the env lists in tox.ini and
# workflows/main.yml, and the `Programming Language ::` specifiers in setup.py
PYTHONS = {
"3.8": "3.8.17",
"3.9": "3.9.17",
"3.10": "3.10.12",
"3.11": "3.11.4",
"3.8": "3.8.18",
"3.9": "3.9.18",
"3.10": "3.10.13",
"3.11": "3.11.5",
"3.12": "3.12-dev",
"3.13": "3.13-dev",
"pypy3.8": "pypy3.8-7.3.11",
Expand Down

0 comments on commit b0335aa

Please sign in to comment.