From ee4690ea18ec2031dcf85f17d7e543d54c1cc0b3 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sun, 15 Dec 2013 18:44:11 +0000 Subject: [PATCH] Math: Skip tests of negative integers exponentiation on Python 2. --- plugins/Math/test.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/Math/test.py b/plugins/Math/test.py index d28b509f7..9c22e30d3 100644 --- a/plugins/Math/test.py +++ b/plugins/Math/test.py @@ -98,10 +98,12 @@ class MathTestCase(PluginTestCase): def testCalc(self): self.assertResponse('calc 5*0.06', str(5*0.06)) self.assertResponse('calc 2.0-7.0', str(2-7)) - self.assertResponse('calc (-1)**.5', 'i') self.assertResponse('calc e**(i*pi)+1', '0') - self.assertRegexp('calc (-5)**.5', '2.236067977[0-9]+i') - self.assertRegexp('calc -((-5)**.5)', '-2.236067977[0-9]+i') + if sys.version_info[0] >= 3: + # Python 2 has bad handling of exponentiation of negative numbers + self.assertResponse('calc (-1)**.5', 'i') + self.assertRegexp('calc (-5)**.5', '2.236067977[0-9]+i') + self.assertRegexp('calc -((-5)**.5)', '-2.236067977[0-9]+i') self.assertNotRegexp('calc [9, 5] + [9, 10]', 'TypeError') self.assertError('calc [9, 5] + [9, 10]') self.assertNotError('calc degrees(2)')