mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-19 22:39:09 +00:00
Fix numpy tests for big endian architectures
Fixes some numpy tests failures on ppc64 in big-endian mode due to little-endian assumptions. Fixes #694.
This commit is contained in:
committed by
Wenzel Jakob
parent
2a75784420
commit
0861be05da
@@ -8,7 +8,7 @@ with pytest.suppress(ImportError):
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def arr():
|
||||
return np.array([[1, 2, 3], [4, 5, 6]], '<u2')
|
||||
return np.array([[1, 2, 3], [4, 5, 6]], '=u2')
|
||||
|
||||
|
||||
def test_array_attributes():
|
||||
@@ -80,9 +80,10 @@ def test_dim_check_fail(arr):
|
||||
([1, 2], [6])])
|
||||
def test_data(arr, args, ret):
|
||||
from pybind11_tests.array import data, data_t
|
||||
from sys import byteorder
|
||||
assert all(data_t(arr, *args) == ret)
|
||||
assert all(data(arr, *args)[::2] == ret)
|
||||
assert all(data(arr, *args)[1::2] == 0)
|
||||
assert all(data(arr, *args)[(0 if byteorder == 'little' else 1)::2] == ret)
|
||||
assert all(data(arr, *args)[(1 if byteorder == 'little' else 0)::2] == 0)
|
||||
|
||||
|
||||
def test_mutate_readonly(arr):
|
||||
|
||||
Reference in New Issue
Block a user