Skip to content

Commit 98e28b8

Browse files
committed
Use buffer_tobytes on non-object types in test
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.
1 parent c20f88f commit 98e28b8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

numcodecs/tests/common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ def check_backwards_compatibility(codec_id, arrays, codecs, precision=None, pref
187187
# setup
188188
i = int(arr_fn.split('.')[-2])
189189
arr = np.load(arr_fn)
190-
arr_bytes = buffer_tobytes(arr)
190+
if arr.dtype.kind is not 'O':
191+
arr_bytes = buffer_tobytes(arr)
191192
if arr.flags.f_contiguous:
192193
order = 'F'
193194
else:

0 commit comments

Comments
 (0)