@@ -2872,13 +2872,13 @@ def test_astype_object(cast_arg: ObjectDtypeArg, target_type: type) -> None:
28722872
28732873 if TYPE_CHECKING :
28742874 # 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 )
28772877 # 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 )
28822882
28832883
28842884@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:
28882888
28892889 if TYPE_CHECKING :
28902890 # 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 )
28942894
28952895
28962896def test_astype_other () -> None :
@@ -2902,7 +2902,7 @@ def test_astype_other() -> None:
29022902
29032903 # Test self-consistent with s.dtype (#747)
29042904 # 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 )
29062906
29072907 # test DecimalDtype
29082908 orseries = pd .Series ([Decimal (x ) for x in [1 , 2 , 3 ]])
@@ -2917,7 +2917,7 @@ def test_astype_other() -> None:
29172917 # Test non-literal string
29182918 # NOTE: currently unsupported! Enable in future.
29192919 # 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)
29212921
29222922
29232923def test_all_astype_args_tested () -> None :
@@ -3224,7 +3224,7 @@ def test_get() -> None:
32243224
32253225def test_series_new_empty () -> None :
32263226 # GH 826
3227- check (assert_type (pd .Series (), " pd.Series" ), pd .Series )
3227+ check (assert_type (pd .Series (), pd .Series ), pd .Series )
32283228
32293229
32303230def test_series_mapping () -> None :
@@ -3406,10 +3406,10 @@ def first_arg_not_series(argument_1: int, ser: pd.Series) -> pd.Series:
34063406
34073407def test_series_apply () -> None :
34083408 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 )
34133413
34143414
34153415def test_diff () -> None :
@@ -3571,7 +3571,7 @@ def callable(x: int) -> str:
35713571
35723572 unknown_series = pd .Series ([1 , 0 , None ])
35733573 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 ),
35753575 pd .Series ,
35763576 )
35773577
@@ -3673,8 +3673,8 @@ class MyDict(TypedDict):
36733673def test_series_empty_dtype () -> None :
36743674 """Test for the creation of a Series from an empty list GH571 to map to a Series."""
36753675 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 )
36783678 # ensure that an empty string does not get matched to Sequence[Never]
36793679 check (assert_type (pd .Series ("" ), "pd.Series[str]" ), pd .Series )
36803680
0 commit comments