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

Function test_ref_qualified_method_vectorization

tests/test_numpy_vectorize.py:250–263  ·  view source on GitHub ↗

Test issue #2234 follow-up: vectorize with lvalue-ref-qualified member pointers. Covers: - vectorize(Return (Class::*)(Args...) &) - vectorize(Return (Class::*)(Args...) const &) - vectorize(Return (Class::*)(Args...) & noexcept) - vectorize(Return (Class::*)(Args...) co

()

Source from the content-addressed store, hash-verified

248
249
250def test_ref_qualified_method_vectorization():
251 """Test issue #2234 follow-up: vectorize with lvalue-ref-qualified member pointers.
252
253 Covers:
254 - vectorize(Return (Class::*)(Args...) &)
255 - vectorize(Return (Class::*)(Args...) const &)
256 - vectorize(Return (Class::*)(Args...) & noexcept)
257 - vectorize(Return (Class::*)(Args...) const & noexcept)
258 """
259 o = m.VectorizeTestClass(3)
260 x = np.array([1, 2], dtype="int")
261 y = np.array([[10], [20]], dtype="float32")
262 assert np.all(o.method_lref(x, y) == [[14, 15], [24, 25]])
263 assert np.all(o.method_const_lref(x, y) == [[14, 15], [24, 25]])
264
265
266@pytest.mark.skipif(

Callers

nothing calls this directly

Calls 4

method_lrefMethod · 0.95
method_const_lrefMethod · 0.95
VectorizeTestClassMethod · 0.80
arrayMethod · 0.80

Tested by

no test coverage detected