Skip to content

Commit

Permalink
Use buffer_tobytes on non-object types in test
Browse files Browse the repository at this point in the history
When running the `check_backwards_compatibility` test, make sure not to
call `buffer_tobytes` on `object` arrays from fixture data. Casting
these to bytes doesn't really make sense as it will return
representation of pointers in the underlying buffer. Not only are the
pointers things we do not want to be comparing, but it is also internal
spec to NumPy and Python that really isn't reliable either. So make sure
to pass through the `object` arrays as is.
  • Loading branch information
jakirkham committed Nov 9, 2018
1 parent bf5638e commit 4425833
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion numcodecs/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ def check_backwards_compatibility(codec_id, arrays, codecs, precision=None, pref
# setup
i = int(arr_fn.split('.')[-2])
arr = np.load(arr_fn)
arr_bytes = buffer_tobytes(arr)
if arr.dtype.kind is not 'O':
arr_bytes = buffer_tobytes(arr)
if arr.flags.f_contiguous:
order = 'F'
else:
Expand Down

0 comments on commit 4425833

Please sign in to comment.