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

Function test_arraylike_signature

tests/test_eigen_matrix.py:823–839  ·  view source on GitHub ↗
(doc)

Source from the content-addressed store, hash-verified

821
822
823def test_arraylike_signature(doc):
824 assert doc(m.round_trip_vector) == (
825 'round_trip_vector(arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.float32, "[m, 1]"])'
826 ' -> typing.Annotated[numpy.typing.NDArray[numpy.float32], "[m, 1]"]'
827 )
828 assert doc(m.round_trip_dense) == (
829 'round_trip_dense(arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.float32, "[m, n]"])'
830 ' -> typing.Annotated[numpy.typing.NDArray[numpy.float32], "[m, n]"]'
831 )
832 assert doc(m.round_trip_dense_ref) == (
833 'round_trip_dense_ref(arg0: typing.Annotated[numpy.typing.NDArray[numpy.float32], "[m, n]", "flags.writeable", "flags.c_contiguous"])'
834 ' -> typing.Annotated[numpy.typing.NDArray[numpy.float32], "[m, n]", "flags.writeable", "flags.c_contiguous"]'
835 )
836 m.round_trip_vector([1.0, 2.0])
837 m.round_trip_dense([[1.0, 2.0], [3.0, 4.0]])
838 with pytest.raises(TypeError, match="incompatible function arguments"):
839 m.round_trip_dense_ref([[1.0, 2.0], [3.0, 4.0]])

Callers

nothing calls this directly

Calls 1

docFunction · 0.70

Tested by

no test coverage detected