Exemplo n.º 1
0
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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
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