@@ -1224,6 +1224,8 @@ def test_comparison_label_based(self):
12241224 for v in [np .nan ]:
12251225 self .assertRaises (TypeError , lambda : t & v )
12261226
1227+
1228+
12271229 def test_comparison_flex_basic (self ):
12281230 left = pd .Series (np .random .randn (10 ))
12291231 right = pd .Series (np .random .randn (10 ))
@@ -1294,6 +1296,19 @@ def test_comparison_flex_alignment_fill(self):
12941296 exp = pd .Series ([True , True , False , False ], index = list ('abcd' ))
12951297 assert_series_equal (left .gt (right , fill_value = 0 ), exp )
12961298
1299+ def test_return_dtypes_bool_op_costant (self ):
1300+ # gh15115
1301+ s = pd .Series ([1 , 3 , 2 ], index = range (3 ))
1302+ for op in ['eq' , 'ne' , 'gt' , 'lt' , 'ge' , 'le' ]:
1303+ f = getattr (s , op )
1304+ self .assertFalse (f (2 ).dtypes , np .dtype ('bool' ))
1305+
1306+ # empty Series
1307+ empty = s .iloc [:0 ]
1308+ for op in ['eq' , 'ne' , 'gt' , 'lt' , 'ge' , 'le' ]:
1309+ f = getattr (empty , op )
1310+ self .assertFalse (f (2 ).dtypes , np .dtype ('bool' ))
1311+
12971312 def test_operators_bitwise (self ):
12981313 # GH 9016: support bitwise op for integer types
12991314 index = list ('bca' )
0 commit comments