numpy: Add test for explicit dtype checks. At present, int64 + uint64 do not exactly match dtype(...).num

This commit is contained in:
Eric Cousineau
2018-03-20 16:55:29 -04:00
committed by Wenzel Jakob
parent c6b699d9c2
commit e9ca89f453
2 changed files with 96 additions and 0 deletions

View File

@@ -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')