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

Method test_help

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

Source from the content-addressed store, hash-verified

3355 raises(ValueError, add_argument, 'bar', nargs=argparse.PARSER)
3356
3357 def test_help(self):
3358 parser = ErrorRaisingArgumentParser(prog='PROG')
3359 group1 = parser.add_mutually_exclusive_group()
3360 group1.add_argument('--foo', action='store_true')
3361 group1.add_argument('--bar', action='store_false')
3362 group2 = parser.add_mutually_exclusive_group()
3363 group2.add_argument('--soup', action='store_true')
3364 group2.add_argument('--nuts', action='store_false')
3365 expected = '''\
3366 usage: PROG [-h] [--foo | --bar] [--soup | --nuts]
3367
3368 options:
3369 -h, --help show this help message and exit
3370 --foo
3371 --bar
3372 --soup
3373 --nuts
3374 '''
3375 self.assertEqual(parser.format_help(), textwrap.dedent(expected))
3376
3377 def test_optional_order(self):
3378 parser = ErrorRaisingArgumentParser(prog='PROG')

Callers

nothing calls this directly

Calls 6

add_argumentMethod · 0.45
assertEqualMethod · 0.45
format_helpMethod · 0.45
dedentMethod · 0.45

Tested by

no test coverage detected