コード例 #1
0
ファイル: test_tree.py プロジェクト: LukaszStem/azure-cli
 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"])
コード例 #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"])
コード例 #3
0
ファイル: test_tree.py プロジェクト: LukaszStem/azure-cli
    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'))
コード例 #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'))
コード例 #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()
コード例 #6
0
ファイル: gather_commands.py プロジェクト: zooba/azure-cli
    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)