Ejemplo n.º 1
0
def test_fuzzy_same_distance():
    # searched string has the same distance to all commands
    cmd_mgr = commandmanager.CommandManager('cliff.fuzzy')
    app = application.App('test', '1.0', cmd_mgr)
    cmd_mgr.add_command('user', test_utils.TestCommand)
    for cmd in cmd_mgr.commands.keys():
        assert utils.damerau_levenshtein('node', cmd, utils.COST) == 8
    matches = app.get_fuzzy_matches('node')
    assert matches == ['complete', 'help', 'user']
Ejemplo n.º 2
0
def test_fuzzy_same_distance():
    # searched string has the same distance to all commands
    cmd_mgr = CommandManager('cliff.fuzzy')
    app = App('test', '1.0', cmd_mgr)
    cmd_mgr.add_command('user', utils.TestCommand)
    for cmd in cmd_mgr.commands.keys():
        assert damerau_levenshtein('node', cmd, COST) == 8
    matches = app.get_fuzzy_matches('node')
    assert matches == ['complete', 'help', 'user']
Ejemplo n.º 3
0
 def test_fuzzy_same_distance(self):
     # searched string has the same distance to all commands
     cmd_mgr = commandmanager.CommandManager('cliff.fuzzy')
     app = application.App('test', '1.0', cmd_mgr)
     cmd_mgr.add_command('user', test_utils.TestCommand)
     for cmd in cmd_mgr.commands.keys():
         self.assertEqual(
             8,
             utils.damerau_levenshtein('node', cmd, utils.COST),
         )
     matches = app.get_fuzzy_matches('node')
     self.assertEqual(['complete', 'help', 'user'], matches)