@@ -570,19 +570,19 @@ def test_slice_replace():
570
570
tm .assert_series_equal (result , exp )
571
571
572
572
573
- def test_strip_lstrip_rstrip ():
574
- values = Series ([" aa " , " bb \n " , np .nan , "cc " ])
573
+ def test_strip_lstrip_rstrip (any_string_dtype ):
574
+ values = Series ([" aa " , " bb \n " , np .nan , "cc " ], dtype = any_string_dtype )
575
575
576
576
result = values .str .strip ()
577
- exp = Series (["aa" , "bb" , np .nan , "cc" ])
577
+ exp = Series (["aa" , "bb" , np .nan , "cc" ], dtype = any_string_dtype )
578
578
tm .assert_series_equal (result , exp )
579
579
580
580
result = values .str .lstrip ()
581
- exp = Series (["aa " , "bb \n " , np .nan , "cc " ])
581
+ exp = Series (["aa " , "bb \n " , np .nan , "cc " ], dtype = any_string_dtype )
582
582
tm .assert_series_equal (result , exp )
583
583
584
584
result = values .str .rstrip ()
585
- exp = Series ([" aa" , " bb" , np .nan , "cc" ])
585
+ exp = Series ([" aa" , " bb" , np .nan , "cc" ], dtype = any_string_dtype )
586
586
tm .assert_series_equal (result , exp )
587
587
588
588
@@ -609,19 +609,19 @@ def test_strip_lstrip_rstrip_mixed():
609
609
tm .assert_almost_equal (rs , xp )
610
610
611
611
612
- def test_strip_lstrip_rstrip_args ():
613
- values = Series (["xxABCxx" , "xx BNSD" , "LDFJH xx" ])
612
+ def test_strip_lstrip_rstrip_args (any_string_dtype ):
613
+ values = Series (["xxABCxx" , "xx BNSD" , "LDFJH xx" ], dtype = any_string_dtype )
614
614
615
615
rs = values .str .strip ("x" )
616
- xp = Series (["ABC" , " BNSD" , "LDFJH " ])
616
+ xp = Series (["ABC" , " BNSD" , "LDFJH " ], dtype = any_string_dtype )
617
617
tm .assert_series_equal (rs , xp )
618
618
619
619
rs = values .str .lstrip ("x" )
620
- xp = Series (["ABCxx" , " BNSD" , "LDFJH xx" ])
620
+ xp = Series (["ABCxx" , " BNSD" , "LDFJH xx" ], dtype = any_string_dtype )
621
621
tm .assert_series_equal (rs , xp )
622
622
623
623
rs = values .str .rstrip ("x" )
624
- xp = Series (["xxABC" , "xx BNSD" , "LDFJH " ])
624
+ xp = Series (["xxABC" , "xx BNSD" , "LDFJH " ], dtype = any_string_dtype )
625
625
tm .assert_series_equal (rs , xp )
626
626
627
627
0 commit comments