Skip to content

Commit 2661b79

Browse files
committed
revise test of bool comparison of float vs string
1 parent 9c10dca commit 2661b79

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

pandas/tests/frame/test_operators.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -316,14 +316,12 @@ def _check_unary_op(op):
316316
# operator.neg is deprecated in numpy >= 1.9
317317
_check_unary_op(operator.inv)
318318

319-
def test_logical_typeerror(self):
320-
if not compat.PY3:
321-
pytest.raises(TypeError, self.frame.__eq__, 'foo')
322-
pytest.raises(TypeError, self.frame.__lt__, 'foo')
323-
pytest.raises(TypeError, self.frame.__gt__, 'foo')
324-
pytest.raises(TypeError, self.frame.__ne__, 'foo')
325-
else:
326-
pytest.skip('test_logical_typeerror not tested on PY3')
319+
@pytest.mark.parametrize('op,res', [('__eq__', False),
320+
('__ne__', True)])
321+
def test_logical_typeerror_with_non_valid(self, op, res):
322+
# we are comparing floats vs a string
323+
result = getattr(self.frame, op)('foo')
324+
assert bool(result.all().all()) is res
327325

328326
def test_logical_with_nas(self):
329327
d = DataFrame({'a': [np.nan, False], 'b': [True, True]})

0 commit comments

Comments
 (0)