Closed bendichter closed 6 months ago
Specifically seems that if you ever see numpy.uint16
it's from taking the type
instead of the .dtype
of an array element or numpy scalar;
array = np.array([1,2,3], dtype="uint16")
type(array[0])
> np.uint16
array[0].dtype
> dtype('uint16')
Is there a test to add or fix (doesn't look like changing this line in source altered the outcome of a test?) for this
Unfortunately,
np.uint16 == np.dtype(np.uint16)
True
however
np.uint16.itemsize()
TypeError: 'getset_descriptor' object is not callable
while
np.dtype(np.uint16).itemsize
2
I suppose I could test asking for the itemsize
Unfortunately,
np.uint16 == np.dtype(np.uint16)
I believe this might be intended since equality is somewhat looser than saying each side of the expression should be of the same object type (with same methods/attributes, etc)
I think the correct assertion would instead be
assert extractor.get_dtype() is np.dtype("uint16")
@CodyCBakerPhD good point. I changed it to is
and it works. You are right, is
should be more restrictive
Apparently
np.uint16
is different fromnp.dtype(np.uint16)