Esempio n. 1
0
 def test_subbranch(self):
     tree3 = CommandBranch("Again")
     tree2 = CommandBranch("World")
     tree2.add_child(tree3)
     tree1 = CommandBranch("Hello")
     tree1.add_child(tree2)
     tree = CommandHead()
     tree.add_child(tree1)
     self.assertEqual(tree.get_subbranch("Hello"), ["World", "Again"])
Esempio n. 2
0
 def test_subbranch(self):
     tree3 = CommandBranch("Again")
     tree2 = CommandBranch("World")
     tree2.add_child(tree3)
     tree1 = CommandBranch("Hello")
     tree1.add_child(tree2)
     tree = CommandHead()
     tree.add_child(tree1)
     self.assertEqual(tree.get_subbranch("Hello"), ["World", "Again"])
Esempio n. 3
0
    def test_in_tree(self):
        # tests in tree
        tree4 = CommandBranch("CB1")
        tree3 = CommandBranch("Again")
        tree2 = CommandBranch("World")
        tree2.add_child(tree3)
        tree2.add_child(tree4)
        tree1 = CommandBranch("Hello")
        tree1.add_child(tree2)
        tree = CommandHead()
        tree.add_child(tree1)
        self.assertTrue(in_tree(tree3, 'Again'))
        self.assertTrue(in_tree(tree2, 'World Again'))
        self.assertTrue(in_tree(tree1, 'Hello World Again'))
        self.assertTrue(in_tree(tree1, 'Hello World CB1'))

        self.assertFalse(in_tree(tree1, 'World Hello CB1'))
        self.assertFalse(in_tree(tree, 'World Hello CB1'))
        self.assertFalse(in_tree(tree, 'Hello World Again CB1'))
Esempio n. 4
0
    def test_in_tree(self):
        """ tests in tree """
        tree4 = CommandBranch("CB1")
        tree3 = CommandBranch("Again")
        tree2 = CommandBranch("World")
        tree2.add_child(tree3)
        tree2.add_child(tree4)
        tree1 = CommandBranch("Hello")
        tree1.add_child(tree2)
        tree = CommandHead()
        tree.add_child(tree1)
        self.assertTrue(in_tree(tree3, 'Again'))
        self.assertTrue(in_tree(tree2, 'World Again'))
        self.assertTrue(in_tree(tree1, 'Hello World Again'))
        self.assertTrue(in_tree(tree1, 'Hello World CB1'))

        self.assertFalse(in_tree(tree1, 'World Hello CB1'))
        self.assertFalse(in_tree(tree, 'World Hello CB1'))
        self.assertFalse(in_tree(tree, 'Hello World Again CB1'))
Esempio n. 5
0
    def __init__(self):
        # everything that is completable
        self.completable = []
        # a completable to the description of what is does
        self.descrip = {}
        # from a command to a list of parameters
        self.command_param = {}

        self.completable_param = []
        self.command_example = {}
        self.command_tree = CommandHead()
        self.param_descript = {}
        self.completer = None
        self.same_param_doubles = {}

        self.gather_from_files()
Esempio n. 6
0
    def __init__(self, config):
        # everything that is completable
        self.completable = []
        # a completable to the description of what is does
        self.descrip = {}
        # from a command to a list of parameters
        self.command_param = {}

        self.completable_param = []
        self.command_example = {}
        self.command_tree = CommandHead()
        self.param_descript = {}
        self.completer = None
        self.same_param_doubles = {}

        self.global_param_descriptions = GLOBAL_PARAM_DESCRIPTIONS
        self.output_choices = OUTPUT_CHOICES
        self.output_options = OUTPUT_OPTIONS
        self.global_param = GLOBAL_PARAM

        self._gather_from_files(config)