@@ -95,19 +95,20 @@ def test_mutator_descriptors():
95
95
with pytest .raises (TypeError ) as excinfo :
96
96
m .fixed_mutator_r (zc )
97
97
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 )
100
100
)
101
101
with pytest .raises (TypeError ) as excinfo :
102
102
m .fixed_mutator_c (zr )
103
103
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 )
106
106
)
107
107
with pytest .raises (TypeError ) as excinfo :
108
108
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 )
111
112
)
112
113
zr .flags .writeable = False
113
114
with pytest .raises (TypeError ):
@@ -201,7 +202,7 @@ def test_negative_stride_from_python(msg):
201
202
msg (excinfo .value )
202
203
== """
203
204
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
205
206
206
207
Invoked with: """
207
208
+ repr (np .array ([5.0 , 4.0 , 3.0 ], dtype = "float32" ))
@@ -213,7 +214,7 @@ def test_negative_stride_from_python(msg):
213
214
msg (excinfo .value )
214
215
== """
215
216
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
217
218
218
219
Invoked with: """
219
220
+ repr (np .array ([7.0 , 4.0 , 1.0 ], dtype = "float32" ))
@@ -634,37 +635,37 @@ def test_nocopy_wrapper():
634
635
with pytest .raises (TypeError ) as excinfo :
635
636
m .get_elem_nocopy (int_matrix_colmajor )
636
637
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 )
638
639
assert m .get_elem_nocopy (dbl_matrix_colmajor ) == 8
639
640
with pytest .raises (TypeError ) as excinfo :
640
641
m .get_elem_nocopy (int_matrix_rowmajor )
641
642
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 )
643
644
with pytest .raises (TypeError ) as excinfo :
644
645
m .get_elem_nocopy (dbl_matrix_rowmajor )
645
646
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 )
647
648
648
649
# For the row-major test, we take a long matrix in row-major, so only the third is allowed:
649
650
with pytest .raises (TypeError ) as excinfo :
650
651
m .get_elem_rm_nocopy (int_matrix_colmajor )
651
652
assert "get_elem_rm_nocopy(): incompatible function arguments." in str (
652
653
excinfo .value
653
654
)
654
- assert ", flags.c_contiguous" in str (excinfo .value )
655
+ assert ', " flags.c_contiguous"' in str (excinfo .value )
655
656
with pytest .raises (TypeError ) as excinfo :
656
657
m .get_elem_rm_nocopy (dbl_matrix_colmajor )
657
658
assert "get_elem_rm_nocopy(): incompatible function arguments." in str (
658
659
excinfo .value
659
660
)
660
- assert ", flags.c_contiguous" in str (excinfo .value )
661
+ assert ', " flags.c_contiguous"' in str (excinfo .value )
661
662
assert m .get_elem_rm_nocopy (int_matrix_rowmajor ) == 8
662
663
with pytest .raises (TypeError ) as excinfo :
663
664
m .get_elem_rm_nocopy (dbl_matrix_rowmajor )
664
665
assert "get_elem_rm_nocopy(): incompatible function arguments." in str (
665
666
excinfo .value
666
667
)
667
- assert ", flags.c_contiguous" in str (excinfo .value )
668
+ assert ', " flags.c_contiguous"' in str (excinfo .value )
668
669
669
670
670
671
def test_eigen_ref_life_support ():
@@ -700,25 +701,25 @@ def test_dense_signature(doc):
700
701
assert (
701
702
doc (m .double_col )
702
703
== """
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]" ]
704
705
"""
705
706
)
706
707
assert (
707
708
doc (m .double_row )
708
709
== """
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]" ]
710
711
"""
711
712
)
712
713
assert doc (m .double_complex ) == (
713
714
"""
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]" ]
716
717
"""
717
718
)
718
719
assert doc (m .double_mat_rm ) == (
719
720
"""
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]" ]
722
723
"""
723
724
)
724
725
0 commit comments