Raise InvalidArgument
with bad shape
argument in xps.arrays()
#3123
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR raises an
InvalidArgument
whenshapes
inxps.arrays()
is not passed as either a valid shape or strategy. This helps avoid confusion when a user might mistakenly pass a strategy-returning function and get an unrelated error (e.g. @asmeurer and I recently).There are a few odd maintenance things too.
Note: Copying this change to
extra.numpy.arrays()
is a bit clunky because the NumPy extra implicitly supports general sequences, where I wanted to only support tuples (although to be fair I hadn't instance checkedshape
as tuples before, but I did pass them blindly toArrayStrategy
). The code that assumes sequences:hypothesis/hypothesis-python/src/hypothesis/extra/numpy.py
Line 447 in 4fe7e3c