import pytest with pytest.suppress(ImportError): import numpy as np @pytest.fixture(scope='function') def arr(): return np.array([[1, 2, 3], [4, 5, 6]], '"].dtype == np.int32 assert defaults["array_t"].dtype == np.float64 results = converting_constructors([1, 2, 3]) for a in results.values(): np.testing.assert_array_equal(a, [1, 2, 3]) assert results["array"].dtype == np.int_ assert results["array_t"].dtype == np.int32 assert results["array_t"].dtype == np.float64 @pytest.requires_numpy def test_greedy_string_overload(): # issue 685 from pybind11_tests.array import issue685 assert issue685("abc") == "string" assert issue685(np.array([97, 98, 99], dtype='b')) == "array" assert issue685(123) == "other"