NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI, #384 most downloaded on PyPI
The property-based testing library for Python
Latest stable
6.170.17
Last release 2 days ago
20 Nov 2026
Ships on a steady schedule
a new release about every 9 days
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
14 years old
1596 releases · first in 2013
Drag across the ruler to compare, or tap a release to open it.
This patch fixes a performance regression on Python 3.12 and 3.13, where the "sys.monitoring" line events for "Phase.explain" were left enabled even a
This patch fixes a performance regression on Python 3.12 and 3.13,
where the "sys.monitoring" line events for "Phase.explain" were left
enabled even after the test had completed (issue #4964).
Thanks to Anubhav Lal for this fix!
The canonical version of these notes (with links) is on readthedocs.
It also avoids a deprecation warning on import under Python 3.16.
This patch speeds up shrinking by comparing a candidate against the
current shrink target lazily, instead of computing the sort key of
every choice on each attempt.
It also avoids a deprecation warning on import under Python 3.16.
The canonical version of these notes (with links) is on readthedocs.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Hypothesis now has 100% type coverage of our public API, as checked by pyrefly.
Hypothesis now has 100% type coverage of our public API, as checked by
pyrefly.
The canonical version of these notes (with links) is on readthedocs.
Hypothesis now has 100% type coverage of our public API, as checked by pyrefly.
This patch adjusts coverage settings for new dependencies; there is no user-visible change.
This patch adjusts coverage settings for new dependencies; there is no
user-visible change.
The canonical version of these notes (with links) is on readthedocs.
This patch adjusts coverage settings for new dependencies; there is no user-visible change.
This patch fixes the codemod for deprecated "characters()" arguments, which previously raised an error when "kwargs" were also passed.
This patch fixes the codemod for deprecated "characters()" arguments,
which previously raised an error when "**kwargs" were also passed.
The canonical version of these notes (with links) is on readthedocs.
This patch fixes the codemod for deprecated ~hypothesis.strategies.characters arguments, which previously raised an error when **kwargs were also passed.
This patch reduces Hypothesis' overhead for each test case. For simple properties and strategies, generating test cases takes up to a third less time
This patch reduces Hypothesis' overhead for each test case. For simple
properties and strategies, generating test cases takes up to a third
less time and shrinking failing examples is up to twice as fast; most
tests will see a smaller improvement. "import hypothesis" is also
about 20% faster.
The canonical version of these notes (with links) is on readthedocs.
This patch makes writing observability data to ".hypothesis/observed" cheaper when tests run in multiple threads, and defers cleaning up old observati
This patch makes writing observability data to ".hypothesis/observed"
cheaper when tests run in multiple threads, and defers cleaning up old
observation files from import time until observations are first
written.
The canonical version of these notes (with links) is on readthedocs.
This patch fixes an internal error from "lists()" with "unique=True", when the elements are a filtered "sampled_from()" with too few allowed values to
This patch fixes an internal error from "lists()" with "unique=True",
when the elements are a filtered "sampled_from()" with too few allowed
values to reach "min_size". It also ensures that "domains()" always
generates at least one subdomain, even with a small "max_length".
We also fixed some internal bookkeeping that could go wrong when an
exception was raised and caught during generation, for example by
"recursive()", which could make shrinking less effective.
The canonical version of these notes (with links) is on readthedocs.
This patch fixes an internal error from |st.lists| with unique=True, when the elements are a filtered |st.sampled_from| with too few allowed values to reach min_size. It also ensures that |st.domains| always generates at least one subdomain, even with a small max_length.
We also fixed some internal bookkeeping that could go wrong when an exception was raised and caught during generation, for example by |st.recursive|, which could make shrinking less effective.
This release fixes a "DeprecationWarning" when importing "hypothesis.extra.dateutil" with dateutil 3.0 or higher (issue #4934 ).
This release fixes a "DeprecationWarning" when importing
"hypothesis.extra.dateutil" with dateutil 3.0 or higher (issue #4934).
The canonical version of these notes (with links) is on readthedocs.
This release fixes a DeprecationWarning when importing hypothesis.extra.dateutil with dateutil 3.0 or higher (4934).
This patch fixes a regression in version 6.170.1, where unique collections of non-empty collections, such as "st.sets(st.frozensets(st.integers(), min
This patch fixes a regression in version 6.170.1, where unique
collections of non-empty collections, such as
"st.sets(st.frozensets(st.integers(), min_size=1), min_size=1)", could
fail the "HealthCheck.large_base_example" health check (issue #4918).
The canonical version of these notes (with links) is on readthedocs.
This improves type coverage of stateful testing.
This improves type coverage of stateful testing.
The canonical version of these notes (with links) is on readthedocs.
This patch adds PyPy 3.12 wheels to releases (issue #4921 ).
This patch adds PyPy 3.12 wheels to releases (issue #4921).
Thanks to @moreati for this contribution!
The canonical version of these notes (with links) is on readthedocs.
This patch adds PyPy 3.12 wheels to releases (4921).
Thanks to @moreati for this contribution!
This patch fixes a bug for users of our "PrimitiveProvider" interface, where "draw_integer" could incorrectly reuse weights from an earlier draw (issu
This patch fixes a bug for users of our "PrimitiveProvider" interface,
where "draw_integer" could incorrectly reuse weights from an earlier
draw (issue #4908).
The canonical version of these notes (with links) is on readthedocs.
This patch fixes a bug for users of our |PrimitiveProvider| interface, where draw_integer could incorrectly reuse weights from an earlier draw (4908).
This fills in the missing type annotations for public-facing attributes of "settings", such as "settings.max_examples" and "settings.database".
This fills in the missing type annotations for public-facing
attributes of "settings", such as "settings.max_examples" and
"settings.database".
The canonical version of these notes (with links) is on readthedocs.
This fills in the missing type annotations for public-facing attributes of |settings|, such as |settings.max_examples| and |settings.database|.
This patch fixes an internal error when the shrinker tried certain invalid values, for example when shrinking "one_of()" between text strategies with
This patch fixes an internal error when the shrinker tried certain
invalid values, for example when shrinking "one_of()" between text
strategies with different alphabets (issue #4905).
The canonical version of these notes (with links) is on readthedocs.
This patch fixes an internal error when the shrinker tried certain invalid values, for example when shrinking |st.one_of| between text strategies with different alphabets (4905).
Add support for Python 3.16, which is still in alpha.
Add support for Python 3.16, which is still in alpha.
The canonical version of these notes (with links) is on readthedocs.
This patch makes generating unique collections, such as "sets()" or "lists()" with "unique=True", considerably more efficient (issue #4458 ). Hypothes
This patch makes generating unique collections, such as "sets()" or
"lists()" with "unique=True", considerably more efficient (issue
#4458). Hypothesis no longer mutates test cases by copying one element
of a unique collection over another element of the same collection,
and no longer probes for minimal examples by drawing every element at
its simplest value - both of which were certain to be rejected, and
could waste several times as many draws from the element strategy as
were actually returned.
The canonical version of these notes (with links) is on readthedocs.
This patch makes generating unique collections, such as |st.sets| or |st.lists| with unique=True, considerably more efficient (4458). Hypothesis no longer mutates test cases by copying one element of a unique collection over another element of the same collection, and no longer probes for minimal examples by drawing every element at its simplest value - both of which were certain to be rejected, and could waste several times as many draws from the element strategy as were actually returned.
This release substantially strengthens "run_conformance_test()", which authors of alternative backends can use to test their provider. It can now test
This release substantially strengthens "run_conformance_test()", which
authors of alternative backends can use to test their provider. It can
now test providers with required constructor arguments, runs many test
cases against each provider, treats running out of entropy as expected
control flow, and checks that providers are able to generate a
representative range of values.
These new checks catch two bugs in the provider underlying
fuzz_one_input, which this release also fixes: integer draws could
never generate negative values, and string draws from an empty
alphabet consumed the whole buffer instead of returning the empty
string.
Verbose output for stateful tests now reads "Test case: " rather than trailing off after the colon.
Thanks to @reachsridhard for reporting the integers bug and
prototyping these improvements.
The canonical version of these notes (with links) is on readthedocs.
This release fixes an error when applying " @given " on Python 3.14 to functions with annotations referring to types that are only available during ty
This release fixes an error when applying "@given" on Python 3.14 to
functions with annotations referring to types that are only available
during type checking, when explicit strategies are supplied (issue
#4897).
Thanks to Arjun Aravind for this fix!
The canonical version of these notes (with links) is on readthedocs.
The ".seed()" method of "randoms()" now accepts the same arguments as "random.Random.seed()", such as "a=" and "version=". Previously, it required exa
The ".seed()" method of "randoms()" now accepts the same arguments as
"random.Random.seed()", such as "a=" and "version=". Previously, it
required exactly one positional argument. Calling ".seed()" without a
seed now raises a clearer error.
The canonical version of these notes (with links) is on readthedocs.
The .seed() method of ~hypothesis.strategies.randoms now accepts the same arguments as random.Random.seed, such as a= and version=. Previously, it required exactly one positional argument. Calling .seed() without a seed now raises a clearer error.
The Ghostwriter now raises a helpful error for functions which take no arguments, instead of writing a test with an invalid empty " @given ()" decorat
The Ghostwriter now raises a helpful error for functions which take no
arguments, instead of writing a test with an invalid empty "@given()"
decorator (issue #4882).
Thanks to deepak7lal for this fix!
The canonical version of these notes (with links) is on readthedocs.
Calling ".map()" or ".flatmap()" on "data()" with a keyword argument now raises the intended error explaining that this is not supported, instead of a
Calling ".map()" or ".flatmap()" on "data()" with a keyword argument
now raises the intended error explaining that this is not supported,
instead of a generic error about an unexpected keyword argument.
The canonical version of these notes (with links) is on readthedocs.
Calling .map() or .flatmap() on ~hypothesis.strategies.data with a keyword argument now raises the intended error explaining that this is not supported, instead of a generic error about an unexpected keyword argument.
This release drops support for Python 3.10, which reached end of life in October 2026.
This release drops support for Python 3.10, which reached end of life
in October 2026.
The canonical version of these notes (with links) is on readthedocs.
This release drops support for Python 3.10, which reached end of life in October 2026.
This patch fixes the type annotation of "from_field()", which claimed to return a strategy for instances of the field type rather than for values of t
This patch fixes the type annotation of "from_field()", which claimed
to return a strategy for instances of the field type rather than for
values of the field.
The canonical version of these notes (with links) is on readthedocs.
This patch fixes the type annotation of ~hypothesis.extra.django.from_field, which claimed to return a strategy for instances of the field type rather than for values of the field.
This patch adds support for PyPy 3.12.
This patch adds support for PyPy 3.12.
The canonical version of these notes (with links) is on readthedocs.
This patch fixes quadratic-time behaviour when summarising the statistics of a test run, which Hypothesis does for every test when running under pytes
This patch fixes quadratic-time behaviour when summarising the
statistics of a test run, which Hypothesis does for every test when
running under pytest. This avoids an apparent hang after the last test
case with a high number of test cases (>100k).
The canonical version of these notes (with links) is on readthedocs.
This patch makes writes to the cache of constants collected from local source files atomic. Previously, a concurrent process sharing the same ".hypoth
This patch makes writes to the cache of constants collected from local
source files atomic. Previously, a concurrent process sharing the same
".hypothesis" directory, such as another pytest-xdist worker, could
read a partially written cache file, which silently changed the data
generated for a given "@seed" (issue #4885).
The canonical version of these notes (with links) is on readthedocs.
We now publish abi3 wheels for Linux s390x (manylinux) and Linux i686 (musllinux).
We now publish abi3 wheels for Linux s390x (manylinux) and Linux i686
(musllinux).
The canonical version of these notes (with links) is on readthedocs.
We now publish abi3 wheels for Linux s390x (manylinux) and Linux i686 (musllinux).
"datetimes()" now generates "tricky" datetimes more often: values on or near daylight-saving and other utc-offset transitions of the drawn timezone -
"datetimes()" now generates "tricky" datetimes more often: values on
or near daylight-saving and other utc-offset transitions of the drawn
timezone - including imaginary wall times, and ambiguous ones with
each value of "fold" - as well as times adjacent to leap seconds and
to well-known datetimes like the millennium and the end of the signed
32-bit Unix epoch (issue #69).
This release also fixes some rare internal errors, where an error
raised partway through updating an internal cache - for example by a
deeply recursive strategy raising "RecursionError" - could leave that
cache corrupted.
The canonical version of these notes (with links) is on readthedocs.
This patch improves shrinking and generation for collection strategies which reject some drawn elements, such as "lists()" with "unique=True". Rejecte
This patch improves shrinking and generation for collection strategies
which reject some drawn elements, such as "lists()" with
"unique=True". Rejected elements are now marked as discarded, so the
shrinker can delete them wholesale and generation avoids revisiting
choices that would be rejected again.
The canonical version of these notes (with links) is on readthedocs.
This patch improves shrinking and generation for collection strategies which reject some drawn elements, such as ~hypothesis.strategies.lists with unique=True. Rejected elements are now marked as discarded, so the shrinker can delete them wholesale and generation avoids revisiting choices that would be rejected again.
Test case observations from observability now give more detail about why a test case failed or was abandoned (issue #3845 ). "metadata" includes a new
Test case observations from observability now give more detail about
why a test case failed or was abandoned (issue #3845). "metadata"
includes a new "status_reason_location" key: a "filename:lineno"
location for the "status_reason", if known - for example the location
of a failing "assume()" call, the ".filter()" call whose predicate
rejected the last drawn value, or the exception for failing tests.
Test cases which exceeded the maximum allowed size now also report a
nonempty "status_reason".
The canonical version of these notes (with links) is on readthedocs.
The "Phase.explain" phase now also varies interactive draws from "data()", annotating each freely-variable "Draw n: ..." line with an "# or any other
The "Phase.explain" phase now also varies interactive draws from
"data()", annotating each freely-variable "Draw n: ..." line with an
"# or any other generated value" comment, just like "@given" arguments
(issue #4403).
This release also fixes two explain-phase bugs: failing test cases
found just as the set of possible inputs was fully enumerated were
reported without running the "Phase.shrink" and "Phase.explain"
phases, and the explain phase could fail to report that the commented
parts can be varied together if the failing example ended with an
uncommented part.
The canonical version of these notes (with links) is on readthedocs.
This patch fixes the "redistribute_numeric_pairs" shrink pass, which incorrectly checked "node1.type" instead of "node2.type" when guarding against fl
This patch fixes the "redistribute_numeric_pairs" shrink pass, which
incorrectly checked "node1.type" instead of "node2.type" when guarding
against float precision loss above "MAX_PRECISE_INTEGER".
The canonical version of these notes (with links) is on readthedocs.
This patch fixes the redistribute_numeric_pairs shrink pass, which incorrectly checked node1.type instead of node2.type when guarding against float precision loss above MAX_PRECISE_INTEGER.
This patch fixes several "from_regex()" bugs (issue #4857, issue
This patch fixes several "from_regex()" bugs (issue #4857, issue #4858, and issue #4859):
Character classes which combine a negative category with other members, like "[\W_]", now match the union of their members instead of incorrectly excluding characters.
Patterns compiled with the "re.ASCII" flag are now handled correctly: inverted categories such as "\D" match the complement of their ascii counterpart, including non-ascii characters; explicit characters and ranges in character classes are not restricted to ascii; and only ascii characters casefold under "re.IGNORECASE".
Subpatterns which cannot be generated from the "alphabet", but may be repeated zero times - like "b*" in "st.from_regex(r"ab", alphabet="a")" - no longer raise an error.
The canonical version of these notes (with links) is on readthedocs.
This patch fixes several ~hypothesis.strategies.from_regex bugs (4857, 4858, and 4859):
Character classes which combine a negative category with other members, like [\W_], now match the union of their members instead of incorrectly excluding characters.
Patterns compiled with the python:re.ASCII flag are now handled correctly: inverted categories such as \D match the complement of their ascii counterpart, including non-ascii characters; explicit characters and ranges in character classes are not restricted to ascii; and only ascii characters casefold under python:re.IGNORECASE.
Subpatterns which cannot be generated from the alphabet, but may be repeated zero times - like b* in st.from_regex(r"a*b*", alphabet="a") - no longer raise an error.
This patch improves the performance of "one_of()" when it can be simplified to a single real strategy, for example "st.integers() | st.nothing()".
This patch improves the performance of "one_of()" when it can be simplified to a single real strategy, for example "st.integers() | st.nothing()".
The canonical version of these notes (with links) is on readthedocs.
This patch improves the performance of |st.one_of| when it can be simplified to a single real strategy, for example st.integers() | st.nothing().
This patch provides a better error message for some "from_regex()" cases where the passed pattern and alphabet were incompatible, as in "st.from_regex
This patch provides a better error message for some "from_regex()"
cases where the passed pattern and alphabet were incompatible, as in
"st.from_regex(r"\d", alphabet="abc")".
Thanks to Dmitry Dygalo for this fix!
The canonical version of these notes (with links) is on readthedocs.
This patch provides a better error message for some ~hypothesis.strategies.from_regex cases where the passed pattern and alphabet were incompatible, as in st.from_regex(r"\d", alphabet="abc").
Thanks to Dmitry Dygalo for this fix!
This release adds support for Python 3.15. "from_type()" can now resolve the new "sentinel" builtin.
This release adds support for Python 3.15. "from_type()" can now
resolve the new "sentinel" builtin.
The canonical version of these notes (with links) is on readthedocs.
This release adds support for Python 3.15. |st.from_type| can now resolve the new sentinel builtin.
We now publish abi3 wheels for Windows arm64 and Linux ppc64le (manylinux + musllinux; issue #4852 ).
We now publish abi3 wheels for Windows arm64 and Linux ppc64le
(manylinux + musllinux; issue #4852).
The canonical version of these notes (with links) is on readthedocs.
We now publish abi3 wheels for Windows arm64 and Linux ppc64le (manylinux + musllinux; 4852).
This release continues the terminology change in version 6.159.0, updating more internal wording and names from "example" to "test case".
This release continues the terminology change in version 6.159.0,
updating more internal wording and names from "example" to "test
case".
The canonical version of these notes (with links) is on readthedocs.
This release continues the terminology change in version 6.159.0, updating more internal wording and names from "example" to "test case".
This release improves our heuristic for when to run the "Phase.target" phase, which optimises scores from "hypothesis.target()". Behaviour is unchange
This release improves our heuristic for when to run the "Phase.target"
phase, which optimises scores from "hypothesis.target()". Behaviour is
unchanged for "max_examples" below 1000. For larger budgets we now
start optimising much earlier, and alternate between generation and
optimisation for as long as scores keep improving, instead of running
a single optimisation pass halfway through the run. Exploratory
searches using "target()" with a large budget should now make much
better use of it (issue #3176).
The canonical version of these notes (with links) is on readthedocs.
This release improves our heuristic for when to run the |Phase.target| phase, which optimises scores from hypothesis.target. Behaviour is unchanged for ~hypothesis.settings.max_examples below 1000. For larger budgets we now start optimising much earlier, and alternate between generation and optimisation for as long as scores keep improving, instead of running a single optimisation pass halfway through the run. Exploratory searches using ~hypothesis.target with a large budget should now make much better use of it (3176).
This patch fixes "BytestringProvider.draw_float" so that it can generate negative floats. Previously, only 64 bits were drawn for a 65-bit float index
This patch fixes "BytestringProvider.draw_float" so that it can
generate negative floats. Previously, only 64 bits were drawn for a
65-bit float index format, so the sign bit was always zero and
negative floats could never be produced.
The canonical version of these notes (with links) is on readthedocs.
This release extends a recent shrinking improvement to many more strategies. In unions like "wide_strategy | specific_strategy", values produced by th
This release extends a recent shrinking improvement to many more
strategies. In unions like "wide_strategy | specific_strategy", values
produced by the specific branch can now be re-encoded and shrunk as if
generated by the wider branch when the strategies involved include
"sampled_from()", "lists()", "tuples()", "dictionaries()" and
"fixed_dictionaries()", "builds()" of a dataclass, "permutations()",
the "dates()" family of strategies, and filtered, deferred, or
recursive combinations of them.
The canonical version of these notes (with links) is on readthedocs.
This release extends a recent shrinking improvement to many more strategies. In unions like wide_strategy | specific_strategy, values produced by the specific branch can now be re-encoded and shrunk as if generated by the wider branch when the strategies involved include ~hypothesis.strategies.sampled_from, ~hypothesis.strategies.lists, ~hypothesis.strategies.tuples, ~hypothesis.strategies.dictionaries and ~hypothesis.strategies.fixed_dictionaries, ~hypothesis.strategies.builds of a dataclass, ~hypothesis.strategies.permutations, the ~hypothesis.strategies.dates family of strategies, and filtered, deferred, or recursive combinations of them.
This release improves shrinking for strategies like st.text() | some_more_complicated_strategy: values produced by the more specific strategy can now
This release improves shrinking for strategies like st.text() | some_more_complicated_strategy: values produced by the more specific strategy can now be shrunk as if they had been generated by the wider strategy. (Values from ~hypothesis.strategies.just are the exception, as generating them makes no choices which could be re-encoded.)
"characters()" now issues the new "NonRoundTrippableCharactersWarning" if the "codec" argument allows generating characters which encode successfully
"characters()" now issues the new "NonRoundTrippableCharactersWarning" if the "codec" argument allows generating characters which encode successfully but do not decode back to the same character - for example the yen sign becomes a backslash under "shift_jis" - since strings containing them do not round-trip (issue #4813). Pass each such character in "include_characters" to generate it without the warning, or in "exclude_characters" to generate only characters which round-trip.
The canonical version of these notes (with links) is on readthedocs.
~hypothesis.strategies.characters now issues the new ~hypothesis.errors.NonRoundTrippableCharactersWarning if the codec argument allows generating characters which encode successfully but do not decode back to the same character - for example the yen sign becomes a backslash under shift_jis - since strings containing them do not round-trip (4813). Pass each such character in include_characters to generate it without the warning, or in exclude_characters to generate only characters which round-trip.
"functions()" now generates functions of the same kind as the "like=" argument, so that async functions, generator functions, and async generator func
"functions()" now generates functions of the same kind as the "like=" argument, so that async functions, generator functions, and async generator functions can be imitated as well as plain functions (issue #4149). "pure=True" is only supported for plain functions.
Generated generator functions yield a list of values drawn from "returns", inferring e.g. "returns=integers()" from an "Iterator[int]" or "AsyncIterator[int]" return-type annotation, and generated async functions follow Trio-style checkpoint semantics.
The canonical version of these notes (with links) is on readthedocs.
Now that we combine coverage data across our CI jobs (issue #4261), this patch removes around a hundred "# pragma: no cover" comments which are no lon
Now that we combine coverage data across our CI jobs (issue #4261), this patch removes around a hundred "# pragma: no cover" comments which are no longer needed, and expands our 100%-coverage requirement to several previously-omitted files.
The "explain" phase no longer reports lines inside the standard library, which were occasionally included in (and made for misleading) explanations.
The constants-collection feature introduced in version 6.131.1 now also collects the float components of complex literals like "3.5j".
The canonical version of these notes (with links) is on readthedocs.
The "alphabet=" argument of "from_regex()" now accepts any collection of length-one strings, such as a tuple or list of characters (issue
The "alphabet=" argument of "from_regex()" now accepts any collection of length-one strings, such as a tuple or list of characters (issue #4829). This matches the existing behavior of "text()".
The canonical version of these notes (with links) is on readthedocs.
The alphabet= argument of |st.from_regex| now accepts any collection of length-one strings, such as a tuple or list of characters (4829). This matches the existing behavior of |st.text|.
This release adds support for generating timezone-aware datetimes in hypothesis.extra.pandas. You can now pass a "DatetimeTZDtype" - such as ""datetim
This release adds support for generating timezone-aware datetimes in hypothesis.extra.pandas. You can now pass a "DatetimeTZDtype" - such as ""datetime64[ns, UTC]"" - as the "dtype" of a "series()", "indexes()", or "column()", and every value will share that single timezone. The datetime resolution is taken from the dtype, so you can also generate e.g. ""datetime64[us, UTC]"" columns, and for UTC and other fixed-offset timezones the generated values cover the full range representable at that resolution - which for coarser units is far wider than the "datetime64[ns]" bounds of roughly 1677-2262 (issue #4020).
Timezone-aware generation requires pandas >= 2.1. Generated values include "NaT" unless you pass an elements strategy which excludes it.
The canonical version of these notes (with links) is on readthedocs.
This release adds support for generating timezone-aware datetimes in hypothesis.extra.pandas. You can now pass a ~pandas.DatetimeTZDtype - such as "datetime64[ns, UTC]" - as the dtype of a ~hypothesis.extra.pandas.series, ~hypothesis.extra.pandas.indexes, or ~hypothesis.extra.pandas.column, and every value will share that single timezone. The datetime resolution is taken from the dtype, so you can also generate e.g. "datetime64[us, UTC]" columns, and for UTC and other fixed-offset timezones the generated values cover the full range representable at that resolution - which for coarser units is far wider than the datetime64[ns] bounds of roughly 1677-2262 (4020).
Timezone-aware generation requires pandas >= 2.1. Generated values include NaT unless you pass an elements strategy which excludes it.
This patch removes a redundant "# pragma: no cover" comment. There is no user-visible change.
This patch removes a redundant "# pragma: no cover" comment. There is no user-visible change.
The canonical version of these notes (with links) is on readthedocs.
This patch removes a redundant # pragma: no cover comment. There is no user-visible change.
This patch updates our vendored list of top-level domains, which is used by the provisional "domains()" strategy.
This patch updates our vendored list of top-level domains, which is used by the provisional "domains()" strategy.
The canonical version of these notes (with links) is on readthedocs.
This patch updates our vendored list of top-level domains, which is used by the provisional ~hypothesis.provisional.domains strategy.
This patch improves the display of functions generated by "functions()". If the "returns=" strategy can only produce a single value, the function is n
This patch improves the display of functions generated by "functions()". If the "returns=" strategy can only produce a single value, the function is now shown as a constant lambda such as "f=lambda x: 3", instead of noting each call to it separately.
We also respect the "repr_pretty()" method of objects which define one in a few more places, such as the arguments of a failing example.
The canonical version of these notes (with links) is on readthedocs.
This patch fixes a bug where a lambda could be displayed with the definition of an unrelated lambda which happened to take the same arguments - for ex
This patch fixes a bug where a lambda could be displayed with the definition of an unrelated lambda which happened to take the same arguments - for example a function generated by "functions()" when shown in a failing example.
The canonical version of these notes (with links) is on readthedocs.
This patch fixes a bug where a lambda could be displayed with the definition of an unrelated lambda which happened to take the same arguments - for example a function generated by ~hypothesis.strategies.functions when shown in a failing example.
We now publish abi3 wheels for Linux armv7l, for both manylinux and musllinux (issue #4818).
We now publish abi3 wheels for Linux armv7l, for both manylinux and musllinux (issue #4818).
The canonical version of these notes (with links) is on readthedocs.
We now publish abi3 wheels for Linux armv7l, for both manylinux and musllinux (4818).
This patch improves our internal "@proxies" decorator, which now preserves the kind of the decorated function: proxies for async functions, generator
This patch improves our internal "@proxies" decorator, which now preserves the kind of the decorated function: proxies for async functions, generator functions, and async generator functions are themselves functions of the same kind. This prepares for upcoming "functions()" support (issue #4149).
The canonical version of these notes (with links) is on readthedocs.
This patch improves our internal @proxies decorator, which now preserves the kind of the decorated function: proxies for async functions, generator functions, and async generator functions are themselves functions of the same kind. This prepares for upcoming ~hypothesis.strategies.functions support (4149).
We now publish abi3 wheels for Linux riscv64, for both manylinux and musllinux (issue #4815).
We now publish abi3 wheels for Linux riscv64, for both manylinux and musllinux (issue #4815).
The canonical version of these notes (with links) is on readthedocs.
We now publish abi3 wheels for Linux riscv64, for both manylinux and musllinux (4815).
"from_lark()" could generate strings which the grammar's lexer tokenizes differently than the terminal they were generated for, and which therefore fa
"from_lark()" could generate strings which the grammar's lexer tokenizes differently than the terminal they were generated for, and which therefore fail to parse - for example "'"""'" for Lark's built- in "ESCAPED_STRING" terminal (issue #4325). Terminal strategies now only generate strings which the lexer would match in their entirety.
The canonical version of these notes (with links) is on readthedocs.
~hypothesis.extra.lark.from_lark could generate strings which the grammar's lexer tokenizes differently than the terminal they were generated for, and which therefore fail to parse - for example '"""' for Lark's built-in ESCAPED_STRING terminal (4325). Terminal strategies now only generate strings which the lexer would match in their entirety.
Values recorded with "note()" are now included in observability reports, as an ordered list of strings under the "metadata.notes" key of each test-cas
Values recorded with "note()" are now included in observability reports, as an ordered list of strings under the "metadata.notes" key of each test-case observation. Previously, notes were only shown in the terminal for the minimal failing test case (or for every test case under "Verbosity.verbose"), and never appeared in observations at all.
The canonical version of these notes (with links) is on readthedocs.
Values recorded with ~hypothesis.note are now included in observability reports, as an ordered list of strings under the metadata.notes key of each test-case observation. Previously, notes were only shown in the terminal for the |minimal failing test case| (or for every test case under |Verbosity.verbose|), and never appeared in observations at all.
"Bundle" now supports efficient ".filter()" and ".map()" methods, which compose with "consumes()" in either order (issue #3944). Previously, "consumes
"Bundle" now supports efficient ".filter()" and ".map()" methods, which compose with "consumes()" in either order (issue #3944). Previously, "consumes(bundle).filter(fn)" could remove rejected values from the bundle while retrying, and "consumes(bundle.filter(fn))" was a type error; filtered draws now select among currently-matching values and consume only the value which was actually drawn.
Thanks to Reagan Lee for the initial implementation of this feature in pull request #4084!
The canonical version of these notes (with links) is on readthedocs.
~hypothesis.stateful.Bundle now supports efficient |.filter| and |.map| methods, which compose with ~hypothesis.stateful.consumes in either order (3944). Previously, consumes(bundle).filter(fn) could remove rejected values from the bundle while retrying, and consumes(bundle.filter(fn)) was a type error; filtered draws now select among currently-matching values and consume only the value which was actually drawn.
Thanks to Reagan Lee for the initial implementation of this feature in 4084!
This is not a breaking change, as we have intentionally not changed any code APIs. In particular, "settings.max_examples" has not been changed.
Hypothesis has historically referred to the single execution of a test function as an "example". However, we have in recent years tended to call a single execution a "test case" instead, which we think is a more precise and less overloaded term.
This release updates user-facing documentation, log messages, and error messages to use the "test case" terminology. Some observability fields which contain raw strings from Hypothesis might change in format as a result.
This is not a breaking change, as we have intentionally not changed any code APIs. In particular, "settings.max_examples" has not been changed.
The canonical version of these notes (with links) is on readthedocs.
This patch implements filter-rewriting for "times()" and "datetimes()": simple comparison filters such as ".filter(partial(operator.ge, bound))" are r
This patch implements filter-rewriting for "times()" and "datetimes()": simple comparison filters such as ".filter(partial(operator.ge, bound))" are rewritten into efficient bounds, as "dates()" already did. This includes strategies inferred from annotated-types bounds like "Annotated[datetime, Gt(...)]", and contradictory filters now give an empty strategy instead of failing health checks.
The canonical version of these notes (with links) is on readthedocs.
This patch implements filter-rewriting for ~hypothesis.strategies.times and ~hypothesis.strategies.datetimes: simple comparison filters such as .filter(partial(operator.ge, bound)) are rewritten into efficient bounds, as ~hypothesis.strategies.dates already did. This includes strategies inferred from annotated-types bounds like Annotated[datetime, Gt(...)], and contradictory filters now give an empty strategy instead of failing health checks.
One column per quarter.