@@ -48,6 +48,9 @@ AR_c: npt.NDArray[np.complex128]
48
48
AR_m :npt .NDArray [np .timedelta64 ]
49
49
AR_M :npt .NDArray [np .datetime64 ]
50
50
AR_O :npt .NDArray [np .object_ ]
51
+ AR_S :npt .NDArray [np .bytes_ ]
52
+ AR_U :npt .NDArray [np .str_ ]
53
+ AR_T :np .ndarray [tuple [Any , ...],np .dtypes .StringDType ]
51
54
AR_floating :npt .NDArray [np .floating ]
52
55
AR_number :npt .NDArray [np .number ]
53
56
AR_Any :npt .NDArray [Any ]
@@ -673,3 +676,45 @@ assert_type(f / AR_floating, npt.NDArray[np.floating])
673
676
assert_type (f // AR_floating ,npt .NDArray [np .floating ])
674
677
assert_type (f % AR_floating ,npt .NDArray [np .floating ])
675
678
assert_type (divmod (f ,AR_floating ),tuple [npt .NDArray [np .floating ],npt .NDArray [np .floating ]])
679
+
680
+ # character-like
681
+
682
+ assert_type (AR_S + b"" ,npt .NDArray [np .bytes_ ])
683
+ assert_type (AR_S + [b"" ],npt .NDArray [np .bytes_ ])
684
+ assert_type ([b"" ]+ AR_S ,npt .NDArray [np .bytes_ ])
685
+ assert_type (AR_S + AR_S ,npt .NDArray [np .bytes_ ])
686
+
687
+ assert_type (AR_U + "" ,npt .NDArray [np .str_ ])
688
+ assert_type (AR_U + ["" ],npt .NDArray [np .str_ ])
689
+ assert_type ("" + AR_U ,npt .NDArray [np .str_ ])
690
+ assert_type (["" ]+ AR_U ,npt .NDArray [np .str_ ])
691
+ assert_type (AR_U + AR_U ,npt .NDArray [np .str_ ])
692
+
693
+ assert_type (AR_T + "" ,np .ndarray [tuple [Any , ...],np .dtypes .StringDType ])
694
+ assert_type (AR_T + ["" ],np .ndarray [tuple [Any , ...],np .dtypes .StringDType ])
695
+ assert_type ("" + AR_T ,np .ndarray [tuple [Any , ...],np .dtypes .StringDType ])
696
+ assert_type (["" ]+ AR_T ,np .ndarray [tuple [Any , ...],np .dtypes .StringDType ])
697
+ assert_type (AR_T + AR_T ,np .ndarray [tuple [Any , ...],np .dtypes .StringDType ])
698
+ assert_type (AR_T + AR_U ,np .ndarray [tuple [Any , ...],np .dtypes .StringDType ])
699
+ assert_type (AR_U + AR_T ,np .ndarray [tuple [Any , ...],np .dtypes .StringDType ])
700
+
701
+ assert_type (AR_S * i ,np .ndarray [tuple [Any , ...],np .dtype [np .bytes_ ]])
702
+ assert_type (AR_S * AR_LIKE_i ,np .ndarray [tuple [Any , ...],np .dtype [np .bytes_ ]])
703
+ assert_type (AR_S * AR_i ,np .ndarray [tuple [Any , ...],np .dtype [np .bytes_ ]])
704
+ assert_type (i * AR_S ,np .ndarray [tuple [Any , ...],np .dtype [np .bytes_ ]])
705
+ # mypy incorrectly infers `AR_LIKE_i * AR_S` as `list[int]`
706
+ assert_type (AR_i * AR_S ,np .ndarray [tuple [Any , ...],np .dtype [np .bytes_ ]])
707
+
708
+ assert_type (AR_U * i ,np .ndarray [tuple [Any , ...],np .dtype [np .str_ ]])
709
+ assert_type (AR_U * AR_LIKE_i ,np .ndarray [tuple [Any , ...],np .dtype [np .str_ ]])
710
+ assert_type (AR_U * AR_i ,np .ndarray [tuple [Any , ...],np .dtype [np .str_ ]])
711
+ assert_type (i * AR_U ,np .ndarray [tuple [Any , ...],np .dtype [np .str_ ]])
712
+ # mypy incorrectly infers `AR_LIKE_i * AR_U` as `list[int]`
713
+ assert_type (AR_i * AR_U ,np .ndarray [tuple [Any , ...],np .dtype [np .str_ ]])
714
+
715
+ assert_type (AR_T * i ,np .ndarray [tuple [Any , ...],np .dtypes .StringDType ])
716
+ assert_type (AR_T * AR_LIKE_i ,np .ndarray [tuple [Any , ...],np .dtypes .StringDType ])
717
+ assert_type (AR_T * AR_i ,np .ndarray [tuple [Any , ...],np .dtypes .StringDType ])
718
+ assert_type (i * AR_T ,np .ndarray [tuple [Any , ...],np .dtypes .StringDType ])
719
+ # mypy incorrectly infers `AR_LIKE_i * AR_T` as `list[int]`
720
+ assert_type (AR_i * AR_T ,np .ndarray [tuple [Any , ...],np .dtypes .StringDType ])