def assertParser(self, _cli, parser_args, argv):
        """
        Assertion method for subparsers, subcommands and positional arguments.
        Parameter argv is a list where the first item is the name of the subparser,
        followed by the subcommand and the remaining items are positional arguments
        """
        number_of_parsing_levels = 2
        cmd = 'cmd_{0}_{1}'.format(argv[0], argv[1]).replace('-', '_')
        self.assertEqual(parser_args.func.__name__, cmd)
        self.assertTrue(argv[1] in _cli.subcommands)
        self.assertTrue(argv[0] in _cli.subparsers)
        number_of_positional_arguments = len(argv) - number_of_parsing_levels
        if number_of_positional_arguments:
            positional_args = []
            for item in parser_args.func.arguments:
                arg = item[0][0]
                if arg.startswith('--'):
                    break
                positional_args.append(arg)
            for index, arg in enumerate(positional_args,
                                        start=number_of_parsing_levels):
                args_type = (
                    parser_args.func.arguments[index - number_of_parsing_levels][1]
                    .get('type')
                )
                if args_type:
                    self.assertEqual(getattr(parser_args, arg),
                                     args_type(argv[index]))
                else:
                    self.assertEqual(getattr(parser_args, arg), argv[index])
                self.assertRaises(SystemExit, self.cli, argv[:index])
dataset/ETHPy150Open ueg1990/imgur-cli/tests/test_cli.py/TestImgurCli.assertParser/original