Math: Skip tests of negative integers exponentiation on Python 2.

This commit is contained in:
Valentin Lorentz 2013-12-15 18:44:11 +00:00
parent 3cc52aefca
commit ee4690ea18

View File

@ -98,10 +98,12 @@ class MathTestCase(PluginTestCase):
def testCalc(self): def testCalc(self):
self.assertResponse('calc 5*0.06', str(5*0.06)) self.assertResponse('calc 5*0.06', str(5*0.06))
self.assertResponse('calc 2.0-7.0', str(2-7)) 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.assertResponse('calc e**(i*pi)+1', '0')
self.assertRegexp('calc (-5)**.5', '2.236067977[0-9]+i') if sys.version_info[0] >= 3:
self.assertRegexp('calc -((-5)**.5)', '-2.236067977[0-9]+i') # 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.assertNotRegexp('calc [9, 5] + [9, 10]', 'TypeError')
self.assertError('calc [9, 5] + [9, 10]') self.assertError('calc [9, 5] + [9, 10]')
self.assertNotError('calc degrees(2)') self.assertNotError('calc degrees(2)')