@@ -10,6 +10,7 @@ AR_S: npt.NDArray[np.bytes_]
10
10
AR_T : np .ndarray [np_t ._Shape , np .dtypes .StringDType ]
11
11
12
12
AR_T_alias : TypeAlias = np .ndarray [np_t ._Shape , np .dtypes .StringDType ]
13
+ AR_TU_alias : TypeAlias = AR_T_alias | npt .NDArray [np .str_ ]
13
14
14
15
assert_type (np .char .equal (AR_U , AR_U ), npt .NDArray [np .bool ])
15
16
assert_type (np .char .equal (AR_S , AR_S ), npt .NDArray [np .bool ])
@@ -50,7 +51,6 @@ assert_type(np.char.capitalize(AR_T), AR_T_alias)
50
51
assert_type (np .char .center (AR_U , 5 ), npt .NDArray [np .str_ ])
51
52
assert_type (np .char .center (AR_S , [2 , 3 , 4 ], b"a" ), npt .NDArray [np .bytes_ ])
52
53
assert_type (np .char .center (AR_T , 5 ), AR_T_alias )
53
- assert_type (np .char .center (AR_T , [2 , 3 , 4 ], "a" ), AR_T_alias )
54
54
55
55
assert_type (np .char .encode (AR_U ), npt .NDArray [np .bytes_ ])
56
56
assert_type (np .char .encode (AR_T ), npt .NDArray [np .bytes_ ])
@@ -62,49 +62,49 @@ assert_type(np.char.expandtabs(AR_T), AR_T_alias)
62
62
63
63
assert_type (np .char .join (AR_U , "_" ), npt .NDArray [np .str_ ])
64
64
assert_type (np .char .join (AR_S , [b"_" , b"" ]), npt .NDArray [np .bytes_ ])
65
- assert_type (np .char .join (AR_T , "_" ), AR_T_alias )
65
+ assert_type (np .char .join (AR_T , "_" ), AR_TU_alias )
66
66
67
67
assert_type (np .char .ljust (AR_U , 5 ), npt .NDArray [np .str_ ])
68
68
assert_type (np .char .ljust (AR_S , [4 , 3 , 1 ], fillchar = [b"a" , b"b" , b"c" ]), npt .NDArray [np .bytes_ ])
69
69
assert_type (np .char .ljust (AR_T , 5 ), AR_T_alias )
70
- assert_type (np .char .ljust (AR_T , [4 , 2 , 1 ], fillchar = ["a" , "b" , "c" ]), AR_T_alias )
70
+ assert_type (np .char .ljust (AR_T , [4 , 2 , 1 ], fillchar = ["a" , "b" , "c" ]), AR_TU_alias )
71
71
72
72
assert_type (np .char .rjust (AR_U , 5 ), npt .NDArray [np .str_ ])
73
73
assert_type (np .char .rjust (AR_S , [4 , 3 , 1 ], fillchar = [b"a" , b"b" , b"c" ]), npt .NDArray [np .bytes_ ])
74
74
assert_type (np .char .rjust (AR_T , 5 ), AR_T_alias )
75
- assert_type (np .char .rjust (AR_T , [4 , 2 , 1 ], fillchar = ["a" , "b" , "c" ]), AR_T_alias )
75
+ assert_type (np .char .rjust (AR_T , [4 , 2 , 1 ], fillchar = ["a" , "b" , "c" ]), AR_TU_alias )
76
76
77
77
assert_type (np .char .lstrip (AR_U ), npt .NDArray [np .str_ ])
78
78
assert_type (np .char .lstrip (AR_S , b"_" ), npt .NDArray [np .bytes_ ])
79
79
assert_type (np .char .lstrip (AR_T ), AR_T_alias )
80
- assert_type (np .char .lstrip (AR_T , "_" ), AR_T_alias )
80
+ assert_type (np .char .lstrip (AR_T , "_" ), AR_TU_alias )
81
81
82
82
assert_type (np .char .rstrip (AR_U ), npt .NDArray [np .str_ ])
83
83
assert_type (np .char .rstrip (AR_S , b"_" ), npt .NDArray [np .bytes_ ])
84
84
assert_type (np .char .rstrip (AR_T ), AR_T_alias )
85
- assert_type (np .char .rstrip (AR_T , "_" ), AR_T_alias )
85
+ assert_type (np .char .rstrip (AR_T , "_" ), AR_TU_alias )
86
86
87
87
assert_type (np .char .strip (AR_U ), npt .NDArray [np .str_ ])
88
88
assert_type (np .char .strip (AR_S , b"_" ), npt .NDArray [np .bytes_ ])
89
89
assert_type (np .char .strip (AR_T ), AR_T_alias )
90
- assert_type (np .char .strip (AR_T , "_" ), AR_T_alias )
90
+ assert_type (np .char .strip (AR_T , "_" ), AR_TU_alias )
91
91
92
92
assert_type (np .char .count (AR_U , "a" , start = [1 , 2 , 3 ]), npt .NDArray [np .int_ ])
93
93
assert_type (np .char .count (AR_S , [b"a" , b"b" , b"c" ], end = 9 ), npt .NDArray [np .int_ ])
94
94
assert_type (np .char .count (AR_T , AR_T , start = [1 , 2 , 3 ]), npt .NDArray [np .int_ ])
95
- assert_type (np .strings .count (AR_T , ["a" , "b" , "c" ], end = 9 ), npt .NDArray [np .int_ ])
95
+ assert_type (np .char .count (AR_T , ["a" , "b" , "c" ], end = 9 ), npt .NDArray [np .int_ ])
96
96
97
97
assert_type (np .char .partition (AR_U , "\n " ), npt .NDArray [np .str_ ])
98
98
assert_type (np .char .partition (AR_S , [b"a" , b"b" , b"c" ]), npt .NDArray [np .bytes_ ])
99
- assert_type (np .char .partition (AR_T , "\n " ), AR_T_alias )
99
+ assert_type (np .char .partition (AR_T , "\n " ), AR_TU_alias )
100
100
101
101
assert_type (np .char .rpartition (AR_U , "\n " ), npt .NDArray [np .str_ ])
102
102
assert_type (np .char .rpartition (AR_S , [b"a" , b"b" , b"c" ]), npt .NDArray [np .bytes_ ])
103
- assert_type (np .char .rpartition (AR_T , "\n " ), AR_T_alias )
103
+ assert_type (np .char .rpartition (AR_T , "\n " ), AR_TU_alias )
104
104
105
105
assert_type (np .char .replace (AR_U , "_" , "-" ), npt .NDArray [np .str_ ])
106
106
assert_type (np .char .replace (AR_S , [b"_" , b"" ], [b"a" , b"b" ]), npt .NDArray [np .bytes_ ])
107
- assert_type (np .char .replace (AR_T , "_" , "_" ), AR_T_alias )
107
+ assert_type (np .char .replace (AR_T , "_" , "_" ), AR_TU_alias )
108
108
109
109
assert_type (np .char .split (AR_U , "_" ), npt .NDArray [np .object_ ])
110
110
assert_type (np .char .split (AR_S , maxsplit = [1 , 2 , 3 ]), npt .NDArray [np .object_ ])
0 commit comments