From c278ca63294cb3e42bd3b36d041766cc26b02c76 Mon Sep 17 00:00:00 2001 From: jreback Date: Wed, 5 Jun 2013 19:47:38 -0400 Subject: [PATCH] TST: failing test on py3k in test_expressions, trying to use 'div' operator --- pandas/tests/test_expressions.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pandas/tests/test_expressions.py b/pandas/tests/test_expressions.py index a496785b0aed3..af7f20a65fa7c 100644 --- a/pandas/tests/test_expressions.py +++ b/pandas/tests/test_expressions.py @@ -69,16 +69,17 @@ def testit(): for op, op_str in [('add','+'),('sub','-'),('mul','*'),('div','/'),('pow','**')]: - op = getattr(operator,op) - result = expr._can_use_numexpr(op, op_str, f, f, 'evaluate') - self.assert_(result == (not f._is_mixed_type)) - - result = expr.evaluate(op, op_str, f, f, use_numexpr=True) - expected = expr.evaluate(op, op_str, f, f, use_numexpr=False) - assert_array_equal(result,expected.values) + op = getattr(operator,op,None) + if op is not None: + result = expr._can_use_numexpr(op, op_str, f, f, 'evaluate') + self.assert_(result == (not f._is_mixed_type)) + + result = expr.evaluate(op, op_str, f, f, use_numexpr=True) + expected = expr.evaluate(op, op_str, f, f, use_numexpr=False) + assert_array_equal(result,expected.values) - result = expr._can_use_numexpr(op, op_str, f2, f2, 'evaluate') - self.assert_(result == False) + result = expr._can_use_numexpr(op, op_str, f2, f2, 'evaluate') + self.assert_(result == False) expr.set_use_numexpr(False)