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

Function test_doc_string

tests/test_eigen_tensor.py:272–294  ·  view source on GitHub ↗
(m, doc)

Source from the content-addressed store, hash-verified

270
271@pytest.mark.parametrize("m", submodules)
272def test_doc_string(m, doc):
273 assert (
274 doc(m.copy_tensor)
275 == 'copy_tensor() -> typing.Annotated[numpy.typing.NDArray[numpy.float64], "[?, ?, ?]"]'
276 )
277 assert (
278 doc(m.copy_fixed_tensor)
279 == 'copy_fixed_tensor() -> typing.Annotated[numpy.typing.NDArray[numpy.float64], "[3, 5, 2]"]'
280 )
281 assert (
282 doc(m.reference_const_tensor)
283 == 'reference_const_tensor() -> typing.Annotated[numpy.typing.NDArray[numpy.float64], "[?, ?, ?]"]'
284 )
285
286 order_flag = f'"flags.{m.needed_options.lower()}_contiguous"'
287 assert doc(m.round_trip_view_tensor) == (
288 f'round_trip_view_tensor(arg0: typing.Annotated[numpy.typing.NDArray[numpy.float64], "[?, ?, ?]", "flags.writeable", {order_flag}])'
289 f' -> typing.Annotated[numpy.typing.NDArray[numpy.float64], "[?, ?, ?]", "flags.writeable", {order_flag}]'
290 )
291 assert doc(m.round_trip_const_view_tensor) == (
292 f'round_trip_const_view_tensor(arg0: typing.Annotated[numpy.typing.NDArray[numpy.float64], "[?, ?, ?]", {order_flag}])'
293 ' -> typing.Annotated[numpy.typing.NDArray[numpy.float64], "[?, ?, ?]"]'
294 )
295
296
297@pytest.mark.parametrize("m", submodules)

Callers

nothing calls this directly

Calls 1

docFunction · 0.70

Tested by

no test coverage detected