# HG changeset patch # User John Mulligan # Date 1257119824 18000 # Sun Nov 01 18:57:04 2009 -0500 # Node ID 073dbac090e540697b5f80516cf42c7ade191d77 # Parent 436cc8e42198e0267916079c3f344001605a6893 verify that exact 'name within name' is still unambiguous diff --git a/test/test_cli_commands.py b/test/test_cli_commands.py --- a/test/test_cli_commands.py +++ b/test/test_cli_commands.py @@ -48,6 +48,11 @@ '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 @@ 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):