hypothesis.extra.numpy
only generates strings of length at most one
#2229
Labels
legibility
make errors helpful and Hypothesis grokable
For reasons I have not fully determined, if you run the following:
You get the following error:
The confusion is not that this code fails with
HYPOTHESIS_DO_NOT_ESCALATE
set but that it doesn't without it set, because our code for this is all wrong.The reason for this is that 'U' is something of a lie of a dtype. Consider the following code:
The 'U' dtype is actually a family of dtypes each of bounded width. When you create an array of unicode objects there's an implicit fixed sized limit on every element. As we create our arrays using
np.zeros
, this results in all unicode we generate being implicitly truncaed to elements of size one.The same issue presumably exists with byte strings.
You can see this more directly by the fact that the following test passes but emits a pile of deprecation warnings:
The text was updated successfully, but these errors were encountered: