MCPcopy Create free account
hub / github.com/pybind/pybind11 / test_constructors

Function test_constructors

tests/test_numpy_array.py:328–341  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

326
327
328def test_constructors():
329 defaults = m.default_constructors()
330 for a in defaults.values():
331 assert a.size == 0
332 assert defaults["array"].dtype == np.array([]).dtype
333 assert defaults["array_t<int32>"].dtype == np.int32
334 assert defaults["array_t<double>"].dtype == np.float64
335
336 results = m.converting_constructors([1, 2, 3])
337 for a in results.values():
338 np.testing.assert_array_equal(a, [1, 2, 3])
339 assert results["array"].dtype == np.dtype(int)
340 assert results["array_t<int32>"].dtype == np.int32
341 assert results["array_t<double>"].dtype == np.float64
342
343
344def test_array_object_type(doc):

Callers

nothing calls this directly

Calls 3

valuesMethod · 0.80
arrayMethod · 0.80
dtypeMethod · 0.45

Tested by

no test coverage detected