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

Function test_passthrough_arguments

tests/test_numpy_vectorize.py:210–240  ·  view source on GitHub ↗
(doc)

Source from the content-addressed store, hash-verified

208
209
210def test_passthrough_arguments(doc):
211 assert doc(m.vec_passthrough) == (
212 "vec_passthrough("
213 + ", ".join(
214 [
215 "arg0: typing.SupportsFloat | typing.SupportsIndex",
216 "arg1: typing.Annotated[numpy.typing.ArrayLike, numpy.float64]",
217 "arg2: typing.Annotated[numpy.typing.ArrayLike, numpy.float64]",
218 "arg3: typing.Annotated[numpy.typing.ArrayLike, numpy.int32]",
219 "arg4: typing.SupportsInt | typing.SupportsIndex",
220 "arg5: m.numpy_vectorize.NonPODClass",
221 "arg6: typing.Annotated[numpy.typing.ArrayLike, numpy.float64]",
222 ]
223 )
224 + ") -> object"
225 )
226
227 b = np.array([[10, 20, 30]], dtype="float64")
228 c = np.array([100, 200]) # NOT a vectorized argument
229 d = np.array([[1000], [2000], [3000]], dtype="int")
230 g = np.array([[1000000, 2000000, 3000000]], dtype="int") # requires casting
231 assert np.all(
232 m.vec_passthrough(1, b, c, d, 10000, m.NonPODClass(100000), g)
233 == np.array(
234 [
235 [1111111, 2111121, 3111131],
236 [1112111, 2112121, 3112131],
237 [1113111, 2113121, 3113131],
238 ]
239 )
240 )
241
242
243def test_method_vectorization():

Callers

nothing calls this directly

Calls 4

arrayMethod · 0.80
NonPODClassMethod · 0.80
docFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected