mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 11:12:47 +01:00
Made separateModes int the argument if it can.
This commit is contained in:
parent
3bdef0fabf
commit
487fb3cc2f
@ -216,7 +216,7 @@ def separateModes(args):
|
||||
[('+s', None), ('-o', 'test')]
|
||||
|
||||
>>> separateModes(['+sntl', '100'])
|
||||
[('+s', None), ('+n', None), ('+t', None), ('+l', '100')]
|
||||
[('+s', None), ('+n', None), ('+t', None), ('+l', 100)]
|
||||
"""
|
||||
if not args:
|
||||
return []
|
||||
@ -236,7 +236,12 @@ def separateModes(args):
|
||||
else:
|
||||
requireArguments = _minusRequireArguments
|
||||
if modes[index] in requireArguments:
|
||||
ret.append((last + modes[index], args.pop(0)))
|
||||
arg = args.pop(0)
|
||||
try:
|
||||
arg = int(arg)
|
||||
except ValueError:
|
||||
pass
|
||||
ret.append((last + modes[index], arg))
|
||||
else:
|
||||
ret.append((last + modes[index], None))
|
||||
index += 1
|
||||
|
@ -154,7 +154,7 @@ class FunctionsTestCase(unittest.TestCase):
|
||||
self.assertEqual(ircutils.separateModes(['+s-o', 'x']),
|
||||
[('+s', None), ('-o', 'x')])
|
||||
self.assertEqual(ircutils.separateModes(['+sntl', '100']),
|
||||
[('+s', None),('+n', None),('+t', None),('+l', '100')])
|
||||
[('+s', None),('+n', None),('+t', None),('+l', 100)])
|
||||
|
||||
def testToLower(self):
|
||||
self.assertEqual('jemfinch', ircutils.toLower('jemfinch'))
|
||||
|
Loading…
Reference in New Issue
Block a user