mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 19:22:45 +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')]
|
[('+s', None), ('-o', 'test')]
|
||||||
|
|
||||||
>>> separateModes(['+sntl', '100'])
|
>>> separateModes(['+sntl', '100'])
|
||||||
[('+s', None), ('+n', None), ('+t', None), ('+l', '100')]
|
[('+s', None), ('+n', None), ('+t', None), ('+l', 100)]
|
||||||
"""
|
"""
|
||||||
if not args:
|
if not args:
|
||||||
return []
|
return []
|
||||||
@ -236,7 +236,12 @@ def separateModes(args):
|
|||||||
else:
|
else:
|
||||||
requireArguments = _minusRequireArguments
|
requireArguments = _minusRequireArguments
|
||||||
if modes[index] in requireArguments:
|
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:
|
else:
|
||||||
ret.append((last + modes[index], None))
|
ret.append((last + modes[index], None))
|
||||||
index += 1
|
index += 1
|
||||||
|
@ -154,7 +154,7 @@ class FunctionsTestCase(unittest.TestCase):
|
|||||||
self.assertEqual(ircutils.separateModes(['+s-o', 'x']),
|
self.assertEqual(ircutils.separateModes(['+s-o', 'x']),
|
||||||
[('+s', None), ('-o', 'x')])
|
[('+s', None), ('-o', 'x')])
|
||||||
self.assertEqual(ircutils.separateModes(['+sntl', '100']),
|
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):
|
def testToLower(self):
|
||||||
self.assertEqual('jemfinch', ircutils.toLower('jemfinch'))
|
self.assertEqual('jemfinch', ircutils.toLower('jemfinch'))
|
||||||
|
Loading…
Reference in New Issue
Block a user