@@ -590,14 +590,15 @@ def test_mode_dropna(self, dropna, expected):
590
590
expected = DataFrame (expected )
591
591
tm .assert_frame_equal (result , expected )
592
592
593
- def test_mode_sortwarning (self ):
593
+ def test_mode_sortwarning (self , using_infer_string ):
594
594
# Check for the warning that is raised when the mode
595
595
# results cannot be sorted
596
596
597
597
df = DataFrame ({"A" : [np .nan , np .nan , "a" , "a" ]})
598
598
expected = DataFrame ({"A" : ["a" , np .nan ]})
599
599
600
- with tm .assert_produces_warning (UserWarning ):
600
+ warning = None if using_infer_string else UserWarning
601
+ with tm .assert_produces_warning (warning ):
601
602
result = df .mode (dropna = False )
602
603
result = result .sort_values (by = "A" ).reset_index (drop = True )
603
604
@@ -1273,7 +1274,8 @@ def test_any_datetime(self):
1273
1274
def test_any_all_bool_only (self ):
1274
1275
# GH 25101
1275
1276
df = DataFrame (
1276
- {"col1" : [1 , 2 , 3 ], "col2" : [4 , 5 , 6 ], "col3" : [None , None , None ]}
1277
+ {"col1" : [1 , 2 , 3 ], "col2" : [4 , 5 , 6 ], "col3" : [None , None , None ]},
1278
+ columns = Index (["col1" , "col2" , "col3" ], dtype = object ),
1277
1279
)
1278
1280
1279
1281
result = df .all (bool_only = True )
0 commit comments