def test_index_offset(arr, args, ret): from pybind11_tests.array import index_at, index_at_t, offset_at, offset_at_t assert index_at(arr, *args) == ret assert index_at_t(arr, *args) == ret assert offset_at(arr, *args) == ret * arr.dtype.itemsize assert offset_at_t(arr, *args) == ret * arr.dtype.itemsize
def test_index_offset(arr, args, ret): from pybind11_tests.array import index_at, index_at_t, offset_at, offset_at_t if index_at(arr, *args) != ret: raise AssertionError if index_at_t(arr, *args) != ret: raise AssertionError if offset_at(arr, *args) != ret * arr.dtype.itemsize: raise AssertionError if offset_at_t(arr, *args) != ret * arr.dtype.itemsize: raise AssertionError