mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
Math: Display a nicer error in case of MemoryError.
This commit is contained in:
parent
2dddfefa98
commit
78a50c81bd
@ -149,6 +149,8 @@ class Math(callbacks.Plugin):
|
||||
irc.error(_('Invalid syntax: %s') % e.args[0])
|
||||
except NameError as e:
|
||||
irc.error(_('%s is not a defined function.') % e.args[0])
|
||||
except MemoryError:
|
||||
irc.error(_('Memory error (too much recursion?)'))
|
||||
except Exception as e:
|
||||
irc.error(str(e))
|
||||
calc = wrap(calc, ['text'])
|
||||
|
@ -135,6 +135,9 @@ class MathTestCase(PluginTestCase):
|
||||
def testCalcStrFloat(self):
|
||||
self.assertResponse('calc 3+33333333333333', '33333333333336')
|
||||
|
||||
def testCalcMemoryError(self):
|
||||
self.assertRegexp('calc ' + '('*500, 'too much recursion')
|
||||
|
||||
def testICalc(self):
|
||||
self.assertResponse('icalc 1^1', '0')
|
||||
self.assertResponse('icalc 10**24', '1' + '0'*24)
|
||||
|
Loading…
Reference in New Issue
Block a user