MCPcopy Index your code
hub / github.com/python/cpython / test_parser_command_help

Method test_parser_command_help

Lib/test/test_argparse.py:2909–2928  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2907 '''))
2908
2909 def test_parser_command_help(self):
2910 self.assertEqual(self.command_help_parser.format_usage(),
2911 'usage: PROG [-h] [--foo] bar {1,2,3} ...\n')
2912 self.assertEqual(self.command_help_parser.format_help(),
2913 textwrap.dedent('''\
2914 usage: PROG [-h] [--foo] bar {1,2,3} ...
2915
2916 main description
2917
2918 positional arguments:
2919 bar bar help
2920 {1,2,3} command help
2921 1 1 help
2922 2 2 help
2923 3 3 help
2924
2925 options:
2926 -h, --help show this help message and exit
2927 --foo foo help
2928 '''))
2929
2930 def assert_bad_help(self, context_type, func, *args, **kwargs):
2931 with self.assertRaisesRegex(ValueError, 'badly formed help string') as cm:

Callers

nothing calls this directly

Calls 4

assertEqualMethod · 0.45
format_usageMethod · 0.45
format_helpMethod · 0.45
dedentMethod · 0.45

Tested by

no test coverage detected