You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ensure that unions of st.characters() and st.sample_from() are usable as alphabet= arguments in st.text() and st.from_regex().
We don't want to auto-convert all such things to characters() by default because that affects shrink order, but as the alphabet argument where we're already more constrained it's fine. Motivating example based on zarr-developers/zarr-python#1746:
fromhypothesisimportgiven, strategiesasstzarr_key_chars=st.sampled_from("abc")
array_names_filter=st.text(zarr_key_chars|st.just("."), min_size=1).filter(lambdat: t[0] !=".")
array_names_regex=st.from_regex(
r"[^.].*",
fullmatch=True,
alphabet=zarr_key_chars|st.just("."),
# InvalidArgument: alphabet=one_of(sampled_from('abc'), just('.')) must be a sampled_from() or characters() strategy
)
@given(array_names_regex)deftest(name): ...
Separately, we should remove the prints here, and change "prefix caret" to "prefix caret to group containing pattern"; in the current form the semantics of match a|b is converted to match a|.*b.
Ensure that unions of
st.characters()
andst.sample_from()
are usable asalphabet=
arguments inst.text()
andst.from_regex()
.We don't want to auto-convert all such things to
characters()
by default because that affects shrink order, but as the alphabet argument where we're already more constrained it's fine. Motivating example based on zarr-developers/zarr-python#1746:Separately, we should remove the prints here, and change "prefix caret" to "prefix caret to group containing pattern"; in the current form the semantics of
match a|b
is converted tomatch a|.*b
.hypothesis/hypothesis-python/src/hypothesis/strategies/_internal/strings.py
Lines 192 to 198 in 395649a
The text was updated successfully, but these errors were encountered: