@@ -95,19 +95,20 @@ def test_mutator_descriptors():
9595 with pytest .raises (TypeError ) as excinfo :
9696 m .fixed_mutator_r (zc )
9797 assert (
98- " (arg0: numpy.ndarray [numpy.float32[5, 6],"
99- " flags.writeable, flags.c_contiguous]) -> None" in str (excinfo .value )
98+ ' (arg0: typing.Annotated [numpy.typing.ArrayLike, numpy. float32, " [5, 6]",'
99+ ' " flags.writeable", " flags.c_contiguous" ]) -> None' in str (excinfo .value )
100100 )
101101 with pytest .raises (TypeError ) as excinfo :
102102 m .fixed_mutator_c (zr )
103103 assert (
104- " (arg0: numpy.ndarray [numpy.float32[5, 6],"
105- " flags.writeable, flags.f_contiguous]) -> None" in str (excinfo .value )
104+ ' (arg0: typing.Annotated [numpy.typing.ArrayLike, numpy. float32, " [5, 6]",'
105+ ' " flags.writeable", " flags.f_contiguous" ]) -> None' in str (excinfo .value )
106106 )
107107 with pytest .raises (TypeError ) as excinfo :
108108 m .fixed_mutator_a (np .array ([[1 , 2 ], [3 , 4 ]], dtype = "float32" ))
109- assert "(arg0: numpy.ndarray[numpy.float32[5, 6], flags.writeable]) -> None" in str (
110- excinfo .value
109+ assert (
110+ '(arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.float32, "[5, 6]", "flags.writeable"]) -> None'
111+ in str (excinfo .value )
111112 )
112113 zr .flags .writeable = False
113114 with pytest .raises (TypeError ):
@@ -201,7 +202,7 @@ def test_negative_stride_from_python(msg):
201202 msg (excinfo .value )
202203 == """
203204 double_threer(): incompatible function arguments. The following argument types are supported:
204- 1. (arg0: numpy.ndarray [numpy.float32[1, 3], flags.writeable]) -> None
205+ 1. (arg0: typing.Annotated [numpy.typing.ArrayLike, numpy. float32, " [1, 3]", " flags.writeable" ]) -> None
205206
206207 Invoked with: """
207208 + repr (np .array ([5.0 , 4.0 , 3.0 ], dtype = "float32" ))
@@ -213,7 +214,7 @@ def test_negative_stride_from_python(msg):
213214 msg (excinfo .value )
214215 == """
215216 double_threec(): incompatible function arguments. The following argument types are supported:
216- 1. (arg0: numpy.ndarray [numpy.float32[3, 1], flags.writeable]) -> None
217+ 1. (arg0: typing.Annotated [numpy.typing.ArrayLike, numpy. float32, " [3, 1]", " flags.writeable" ]) -> None
217218
218219 Invoked with: """
219220 + repr (np .array ([7.0 , 4.0 , 1.0 ], dtype = "float32" ))
@@ -634,37 +635,37 @@ def test_nocopy_wrapper():
634635 with pytest .raises (TypeError ) as excinfo :
635636 m .get_elem_nocopy (int_matrix_colmajor )
636637 assert "get_elem_nocopy(): incompatible function arguments." in str (excinfo .value )
637- assert ", flags.f_contiguous" in str (excinfo .value )
638+ assert ', " flags.f_contiguous"' in str (excinfo .value )
638639 assert m .get_elem_nocopy (dbl_matrix_colmajor ) == 8
639640 with pytest .raises (TypeError ) as excinfo :
640641 m .get_elem_nocopy (int_matrix_rowmajor )
641642 assert "get_elem_nocopy(): incompatible function arguments." in str (excinfo .value )
642- assert ", flags.f_contiguous" in str (excinfo .value )
643+ assert ', " flags.f_contiguous"' in str (excinfo .value )
643644 with pytest .raises (TypeError ) as excinfo :
644645 m .get_elem_nocopy (dbl_matrix_rowmajor )
645646 assert "get_elem_nocopy(): incompatible function arguments." in str (excinfo .value )
646- assert ", flags.f_contiguous" in str (excinfo .value )
647+ assert ', " flags.f_contiguous"' in str (excinfo .value )
647648
648649 # For the row-major test, we take a long matrix in row-major, so only the third is allowed:
649650 with pytest .raises (TypeError ) as excinfo :
650651 m .get_elem_rm_nocopy (int_matrix_colmajor )
651652 assert "get_elem_rm_nocopy(): incompatible function arguments." in str (
652653 excinfo .value
653654 )
654- assert ", flags.c_contiguous" in str (excinfo .value )
655+ assert ', " flags.c_contiguous"' in str (excinfo .value )
655656 with pytest .raises (TypeError ) as excinfo :
656657 m .get_elem_rm_nocopy (dbl_matrix_colmajor )
657658 assert "get_elem_rm_nocopy(): incompatible function arguments." in str (
658659 excinfo .value
659660 )
660- assert ", flags.c_contiguous" in str (excinfo .value )
661+ assert ', " flags.c_contiguous"' in str (excinfo .value )
661662 assert m .get_elem_rm_nocopy (int_matrix_rowmajor ) == 8
662663 with pytest .raises (TypeError ) as excinfo :
663664 m .get_elem_rm_nocopy (dbl_matrix_rowmajor )
664665 assert "get_elem_rm_nocopy(): incompatible function arguments." in str (
665666 excinfo .value
666667 )
667- assert ", flags.c_contiguous" in str (excinfo .value )
668+ assert ', " flags.c_contiguous"' in str (excinfo .value )
668669
669670
670671def test_eigen_ref_life_support ():
@@ -700,25 +701,25 @@ def test_dense_signature(doc):
700701 assert (
701702 doc (m .double_col )
702703 == """
703- double_col(arg0: numpy.ndarray [numpy.float32[m, 1]]) -> numpy.ndarray [numpy.float32[m, 1]]
704+ double_col(arg0: typing.Annotated [numpy.typing.ArrayLike, numpy. float32, " [m, 1]" ]) -> typing.Annotated[ numpy.typing.NDArray [numpy.float32], " [m, 1]" ]
704705 """
705706 )
706707 assert (
707708 doc (m .double_row )
708709 == """
709- double_row(arg0: numpy.ndarray [numpy.float32[1, n]]) -> numpy.ndarray [numpy.float32[1, n]]
710+ double_row(arg0: typing.Annotated [numpy.typing.ArrayLike, numpy. float32, " [1, n]" ]) -> typing.Annotated[ numpy.typing.NDArray [numpy.float32], " [1, n]" ]
710711 """
711712 )
712713 assert doc (m .double_complex ) == (
713714 """
714- double_complex(arg0: numpy.ndarray [numpy.complex64[m, 1]])"""
715- """ -> numpy.ndarray [numpy.complex64[m, 1]]
715+ double_complex(arg0: typing.Annotated [numpy.typing.ArrayLike, numpy. complex64, " [m, 1]" ])"""
716+ """ -> typing.Annotated[ numpy.typing.NDArray [numpy.complex64], " [m, 1]" ]
716717 """
717718 )
718719 assert doc (m .double_mat_rm ) == (
719720 """
720- double_mat_rm(arg0: numpy.ndarray [numpy.float32[m, n]])"""
721- """ -> numpy.ndarray [numpy.float32[m, n]]
721+ double_mat_rm(arg0: typing.Annotated [numpy.typing.ArrayLike, numpy. float32, " [m, n]" ])"""
722+ """ -> typing.Annotated[ numpy.typing.NDArray [numpy.float32], " [m, n]" ]
722723 """
723724 )
724725
0 commit comments