Skip to content

Commit a55d28e

Browse files
authored
Fix rtd (#2072)
1 parent c1cda0d commit a55d28e

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

.readthedocs.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@ version: 2
44
# Set the version of Python and other tools you might need
55
build:
66
os: ubuntu-lts-latest
7-
tools: {python: "3.11"}
7+
tools: {python: "3.12"}
88
jobs:
99
pre_create_environment:
1010
- asdf plugin add poetry
1111
- asdf install poetry latest
1212
- asdf global poetry latest
1313
- poetry config virtualenvs.create false
1414
- poetry self add poetry-plugin-export
15-
- poetry export --only main --only docs --extras check_laws --format=requirements.txt --output=requirements.txt
15+
- poetry export
16+
--only main --only docs
17+
--extras check_laws --extras compatible_mypy
18+
--format=requirements.txt
19+
--output=requirements.txt
1620

1721
python:
1822
install:

docs/pages/contrib/hypothesis_plugins.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ like ``Future``, ``ReaderFutureResult``, etc
108108
that have complex ``__init__`` signatures.
109109
And we don't want to mess with them.
110110

111-
Warning::
111+
.. warning::
112+
112113
Checking laws is not compatible with ``pytest-xdist``,
113114
because we use a lot of global mutable state there.
114115
Please, use ``returns_lawful`` marker

returns/contrib/hypothesis/laws.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
@final
2525
@dataclasses.dataclass(frozen=True)
2626
class Settings:
27-
"""Settings for the law tests.
27+
"""
28+
Settings for the law tests.
2829
2930
This sets the context for each generated law test, by temporarily
3031
registering strategies for various types and passing any ``hypothesis``
@@ -76,11 +77,11 @@ def default_settings(container_type: type[Lawful]) -> Settings:
7677
We use some special strategies by default, but
7778
they can be overridden by the user if needed:
7879
79-
+ `TypeVar`: We need to make sure that the values generated behave
80-
sensibly when tested for equality.
80+
- ``TypeVar``: We need to make sure that the values generated behave
81+
sensibly when tested for equality.
8182
82-
+ `collections.abc.Callable`: We need to generate pure functions, which
83-
are not the default.
83+
- ``collections.abc.Callable``: We need to generate pure functions,
84+
which are not the default.
8485
8586
Note that this is `collections.abc.Callable`, NOT `typing.Callable`. This
8687
is because, at runtime, `typing.get_origin(Callable[[int], str])` is
@@ -186,10 +187,11 @@ def pure_functions_factory(thing) -> st.SearchStrategy:
186187

187188

188189
def type_vars_factory(thing: type[object]) -> StrategyFactory:
189-
"""Strategy factory for ``TypeVar``s.
190+
"""
191+
Strategy factory for ``TypeVar`` objects.
190192
191-
We ensure that values inside strategies are self-equal. For example,
192-
``nan`` does not work for us.
193+
We ensure that values inside strategies are self-equal.
194+
For example, ``float('nan')`` does not work for us.
193195
"""
194196
return types.resolve_TypeVar(thing).filter( # type: ignore[no-any-return]
195197
lambda inner: inner == inner, # noqa: PLR0124, WPS312

0 commit comments

Comments
 (0)