@@ 48,6 48,11 @@ CMDTABLE_C = {
'fish': {'target': cmd2, 'opts': [], 'help': 'other stuff'},
}
+CMDTABLE_D = [
+ ('tea', cmd1, '', [], 'FLAVOR TEMP'),
+ ('tear', cmd2, '', [], ''),
+ ]
+
class TestCliCommands(unittest.TestCase):
def test_parse_cli_cmd(self):
@@ 249,7 254,11 @@ class TestCliCommands(unittest.TestCase)
self.assertRaises(TypeError,
commander.main, GOPT_A, CMDTABLE_A, 'baz'.split())
-
+ def test_fuzzy_names(self):
+ cmd, opts, args = commander.parse(GOPT_A, CMDTABLE_D, 'tear'.split())
+ self.assertEqual(cmd.target, cmd2)
+ cmd, opts, args = commander.parse(GOPT_A, CMDTABLE_D, 'tea'.split())
+ self.assertEqual(cmd.target, cmd1)
class Capture(list):