@@ -2872,13 +2872,13 @@ def test_astype_object(cast_arg: ObjectDtypeArg, target_type: type) -> None:
2872
2872
2873
2873
if TYPE_CHECKING :
2874
2874
# python object
2875
- assert_type (s .astype (object ), " pd.Series" )
2876
- assert_type (s .astype ("object" ), " pd.Series" )
2875
+ assert_type (s .astype (object ), pd .Series )
2876
+ assert_type (s .astype ("object" ), pd .Series )
2877
2877
# numpy object
2878
- assert_type (s .astype (np .object_ ), " pd.Series" )
2879
- # assert_type(s.astype("object_"), " pd.Series" ) # NOTE: not assigned
2880
- # assert_type(s.astype("object0"), " pd.Series" ) # NOTE: not assigned
2881
- assert_type (s .astype ("O" ), " pd.Series" )
2878
+ assert_type (s .astype (np .object_ ), pd .Series )
2879
+ # assert_type(s.astype("object_"), pd.Series) # NOTE: not assigned
2880
+ # assert_type(s.astype("object0"), pd.Series) # NOTE: not assigned
2881
+ assert_type (s .astype ("O" ), pd .Series )
2882
2882
2883
2883
2884
2884
@pytest .mark .parametrize ("cast_arg, target_type" , ASTYPE_VOID_ARGS , ids = repr )
@@ -2888,9 +2888,9 @@ def test_astype_void(cast_arg: VoidDtypeArg, target_type: type) -> None:
2888
2888
2889
2889
if TYPE_CHECKING :
2890
2890
# numpy void
2891
- assert_type (s .astype (np .void ), " pd.Series" )
2892
- assert_type (s .astype ("void" ), " pd.Series" )
2893
- assert_type (s .astype ("V" ), " pd.Series" )
2891
+ assert_type (s .astype (np .void ), pd .Series )
2892
+ assert_type (s .astype ("void" ), pd .Series )
2893
+ assert_type (s .astype ("V" ), pd .Series )
2894
2894
2895
2895
2896
2896
def test_astype_other () -> None :
@@ -2902,7 +2902,7 @@ def test_astype_other() -> None:
2902
2902
2903
2903
# Test self-consistent with s.dtype (#747)
2904
2904
# NOTE: https://github.com/python/typing/issues/801#issuecomment-1646171898
2905
- check (assert_type (s .astype (s .dtype ), " pd.Series" ), pd .Series , np .integer )
2905
+ check (assert_type (s .astype (s .dtype ), pd .Series ), pd .Series , np .integer )
2906
2906
2907
2907
# test DecimalDtype
2908
2908
orseries = pd .Series ([Decimal (x ) for x in [1 , 2 , 3 ]])
@@ -2917,7 +2917,7 @@ def test_astype_other() -> None:
2917
2917
# Test non-literal string
2918
2918
# NOTE: currently unsupported! Enable in future.
2919
2919
# string: str = "int" # not Literal!
2920
- # check(assert_type(s.astype(string), " pd.Series" ), pd.Series, np.integer)
2920
+ # check(assert_type(s.astype(string), pd.Series), pd.Series, np.integer)
2921
2921
2922
2922
2923
2923
def test_all_astype_args_tested () -> None :
@@ -3224,7 +3224,7 @@ def test_get() -> None:
3224
3224
3225
3225
def test_series_new_empty () -> None :
3226
3226
# GH 826
3227
- check (assert_type (pd .Series (), " pd.Series" ), pd .Series )
3227
+ check (assert_type (pd .Series (), pd .Series ), pd .Series )
3228
3228
3229
3229
3230
3230
def test_series_mapping () -> None :
@@ -3406,10 +3406,10 @@ def first_arg_not_series(argument_1: int, ser: pd.Series) -> pd.Series:
3406
3406
3407
3407
def test_series_apply () -> None :
3408
3408
s = pd .Series (["A" , "B" , "AB" ])
3409
- check (assert_type (s .apply (tuple ), " pd.Series" ), pd .Series )
3410
- check (assert_type (s .apply (list ), " pd.Series" ), pd .Series )
3411
- check (assert_type (s .apply (set ), " pd.Series" ), pd .Series )
3412
- check (assert_type (s .apply (frozenset ), " pd.Series" ), pd .Series )
3409
+ check (assert_type (s .apply (tuple ), pd .Series ), pd .Series )
3410
+ check (assert_type (s .apply (list ), pd .Series ), pd .Series )
3411
+ check (assert_type (s .apply (set ), pd .Series ), pd .Series )
3412
+ check (assert_type (s .apply (frozenset ), pd .Series ), pd .Series )
3413
3413
3414
3414
3415
3415
def test_diff () -> None :
@@ -3571,7 +3571,7 @@ def callable(x: int) -> str:
3571
3571
3572
3572
unknown_series = pd .Series ([1 , 0 , None ])
3573
3573
check (
3574
- assert_type (unknown_series .map ({1 : True , 0 : False , None : None }), " pd.Series" ),
3574
+ assert_type (unknown_series .map ({1 : True , 0 : False , None : None }), pd .Series ),
3575
3575
pd .Series ,
3576
3576
)
3577
3577
@@ -3673,8 +3673,8 @@ class MyDict(TypedDict):
3673
3673
def test_series_empty_dtype () -> None :
3674
3674
"""Test for the creation of a Series from an empty list GH571 to map to a Series."""
3675
3675
new_tab : Sequence [Never ] = [] # need to be typehinted to please mypy
3676
- check (assert_type (pd .Series (new_tab ), " pd.Series" ), pd .Series )
3677
- check (assert_type (pd .Series ([]), " pd.Series" ), pd .Series )
3676
+ check (assert_type (pd .Series (new_tab ), pd .Series ), pd .Series )
3677
+ check (assert_type (pd .Series ([]), pd .Series ), pd .Series )
3678
3678
# ensure that an empty string does not get matched to Sequence[Never]
3679
3679
check (assert_type (pd .Series ("" ), "pd.Series[str]" ), pd .Series )
3680
3680
0 commit comments