@@ -1224,6 +1224,8 @@ def test_comparison_label_based(self):
1224
1224
for v in [np .nan ]:
1225
1225
self .assertRaises (TypeError , lambda : t & v )
1226
1226
1227
+
1228
+
1227
1229
def test_comparison_flex_basic (self ):
1228
1230
left = pd .Series (np .random .randn (10 ))
1229
1231
right = pd .Series (np .random .randn (10 ))
@@ -1294,6 +1296,19 @@ def test_comparison_flex_alignment_fill(self):
1294
1296
exp = pd .Series ([True , True , False , False ], index = list ('abcd' ))
1295
1297
assert_series_equal (left .gt (right , fill_value = 0 ), exp )
1296
1298
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
+
1297
1312
def test_operators_bitwise (self ):
1298
1313
# GH 9016: support bitwise op for integer types
1299
1314
index = list ('bca' )
0 commit comments