Error with floats(max_value=<one less than inf>, allow_infinity=False, exclude_max=True) could be more helpful
#3207
Labels
legibility
make errors helpful and Hypothesis grokable
This has already been mentioned in #1859 (comment), but I couldn't find a standalone issue for it.
The error
allow_infinity=False excludes min_value=inf(added in #1860 I believe) is a bit confusing to see when you are certain you didn't passmax_value=inf. It took me far longer than I'd like to realize that the highest-possible finite float was getting passed in asmax_value, leaving no room for a larger value besides infinity. If worded differently, this might have saved me some time.I assume this is happening because the
min_valuegetsnext_up'd in:hypothesis/hypothesis-python/src/hypothesis/strategies/_internal/numbers.py
Lines 370 to 373 in 22607fe
so when the check actually happens, it appears the user has passed in
inf.Even a message like
allow_infinity=False exclude_max=True excludes min_value={sys.float_info.max}would have made the problem much clearer, though I think it could be worded in a more friendly way for users who are less familiar with how floats work.The text was updated successfully, but these errors were encountered: