| 821 | |
| 822 | |
| 823 | def 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]]) |