@@ -206,6 +206,7 @@ def _compare_other(self, ser: pd.Series, data, op, other):
206
206
# comparison should match point-wise comparisons
207
207
result = op (ser , other )
208
208
expected = ser .combine (other , op )
209
+ expected = self ._cast_pointwise_result (op .__name__ , ser , other , expected )
209
210
tm .assert_series_equal (result , expected )
210
211
211
212
else :
@@ -218,6 +219,9 @@ def _compare_other(self, ser: pd.Series, data, op, other):
218
219
if exc is None :
219
220
# Didn't error, then should match pointwise behavior
220
221
expected = ser .combine (other , op )
222
+ expected = self ._cast_pointwise_result (
223
+ op .__name__ , ser , other , expected
224
+ )
221
225
tm .assert_series_equal (result , expected )
222
226
else :
223
227
with pytest .raises (type (exc )):
@@ -229,7 +233,7 @@ def test_compare_scalar(self, data, comparison_op):
229
233
230
234
def test_compare_array (self , data , comparison_op ):
231
235
ser = pd .Series (data )
232
- other = pd .Series ([data [0 ]] * len (data ))
236
+ other = pd .Series ([data [0 ]] * len (data ), dtype = data . dtype )
233
237
self ._compare_other (ser , data , comparison_op , other )
234
238
235
239
0 commit comments