@@ -3276,18 +3276,34 @@ def test_map_na() -> None:
3276
3276
3277
3277
mapping = {1 : "a" , 2 : "b" , 3 : "c" }
3278
3278
check (assert_type (s .map (mapping , na_action = None ), "pd.Series[str]" ), pd .Series , str )
3279
+ check (assert_type (s .map (mapping ), "pd.Series[str]" ), pd .Series , str )
3279
3280
3280
3281
def callable (x : int | NAType ) -> str | NAType :
3281
3282
if isinstance (x , int ):
3282
3283
return str (x )
3283
3284
return x
3284
3285
3286
+ def bad_callable (x : int ) -> int :
3287
+ return x + 1
3288
+
3289
+ s .map (
3290
+ bad_callable , na_action = None # type: ignore[arg-type] # pyright: ignore[reportCallIssue, reportArgumentType]
3291
+ )
3292
+ s .map (bad_callable ) # type: ignore[arg-type] # pyright: ignore[reportArgumentType]
3293
+ check (
3294
+ assert_type (s .map (bad_callable , na_action = "ignore" ), "pd.Series[int]" ),
3295
+ pd .Series ,
3296
+ int ,
3297
+ )
3298
+
3285
3299
check (
3286
3300
assert_type (s .map (callable , na_action = None ), "pd.Series[str]" ), pd .Series , str
3287
3301
)
3302
+ check (assert_type (s .map (callable ), "pd.Series[str]" ), pd .Series , str )
3288
3303
3289
3304
series = pd .Series (["a" , "b" , "c" ])
3290
3305
check (assert_type (s .map (series , na_action = None ), "pd.Series[str]" ), pd .Series , str )
3306
+ check (assert_type (s .map (series ), "pd.Series[str]" ), pd .Series , str )
3291
3307
3292
3308
3293
3309
def test_case_when () -> None :
0 commit comments