github HypothesisWorks/hypothesis hypothesis-python-6.152.7
Hypothesis for Python - version 6.152.7

8 hours ago

This patch improves our type hints for ".filter()" to work with
"typing.TypeGuard". For example:

from typing import TypeGuard

from hypothesis import strategies as st

def is_str(x: object) -> TypeGuard[str]:
return isinstance(x, str)

s = st.from_type(object).filter(is_str)

previously: SearchStrategy[object]

now: SearchStrategy[str]

reveal_type(s)

The canonical version of these notes (with links) is on readthedocs.

Don't miss a new hypothesis release

NewReleases is sending notifications on new releases.