mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 03:02:52 +01:00
commands: Handle OverflowError in _int
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
This commit is contained in:
parent
58e7e61d69
commit
e7d0bfd2d0
@ -211,7 +211,10 @@ def _int(s):
|
||||
return int(s, base)
|
||||
except ValueError:
|
||||
if base == 10:
|
||||
return int(float(s))
|
||||
try:
|
||||
return int(float(s))
|
||||
except OverflowError:
|
||||
raise ValueError('I don\'t understand numbers that large.')
|
||||
else:
|
||||
raise
|
||||
|
||||
|
@ -72,6 +72,7 @@ class GeneralContextTestCase(CommandsTestCase):
|
||||
def testSpecInt(self):
|
||||
self.assertState(['int'], ['1'], [1])
|
||||
self.assertState(['int', 'int', 'int'], ['1', '2', '3'], [1, 2, 3])
|
||||
self.assertError(['int'], ['9e999'])
|
||||
|
||||
def testSpecNick(self):
|
||||
strict = conf.supybot.protocols.irc.strictRfc()
|
||||
|
Loading…
Reference in New Issue
Block a user