mirror of
https://github.com/pybind/pybind11.git
synced 2026-05-03 21:21:37 +00:00
numpy: Add test for explicit dtype checks. At present, int64 + uint64 do not exactly match dtype(...).num
This commit is contained in:
committed by
Wenzel Jakob
parent
c6b699d9c2
commit
e9ca89f453
@@ -7,6 +7,21 @@ with pytest.suppress(ImportError):
|
||||
import numpy as np
|
||||
|
||||
|
||||
def test_dtypes():
|
||||
# See issue #1328.
|
||||
# - Platform-dependent sizes.
|
||||
for size_check in m.get_platform_dtype_size_checks():
|
||||
print(size_check)
|
||||
assert size_check.size_cpp == size_check.size_numpy, size_check
|
||||
# - Concrete sizes.
|
||||
for check in m.get_concrete_dtype_checks():
|
||||
print(check)
|
||||
assert check.numpy == check.pybind11, check
|
||||
if check.numpy.num != check.pybind11.num:
|
||||
print("NOTE: typenum mismatch for {}: {} != {}".format(
|
||||
check, check.numpy.num, check.pybind11.num))
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def arr():
|
||||
return np.array([[1, 2, 3], [4, 5, 6]], '=u2')
|
||||
|
||||
Reference in New Issue
Block a user