MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_help

Method test_help

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

Source from the content-addressed store, hash-verified

3244 raises(ValueError, add_argument, 'bar', nargs=argparse.PARSER)
3245
3246 def test_help(self):
3247 parser = ErrorRaisingArgumentParser(prog='PROG')
3248 group1 = parser.add_mutually_exclusive_group()
3249 group1.add_argument('--foo', action='store_true')
3250 group1.add_argument('--bar', action='store_false')
3251 group2 = parser.add_mutually_exclusive_group()
3252 group2.add_argument('--soup', action='store_true')
3253 group2.add_argument('--nuts', action='store_false')
3254 expected = '''\
3255 usage: PROG [-h] [--foo | --bar] [--soup | --nuts]
3256
3257 options:
3258 -h, --help show this help message and exit
3259 --foo
3260 --bar
3261 --soup
3262 --nuts
3263 '''
3264 self.assertEqual(parser.format_help(), textwrap.dedent(expected))
3265
3266 def test_optional_order(self):
3267 parser = ErrorRaisingArgumentParser(prog='PROG')

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected