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

Method test_groups_parents

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

Source from the content-addressed store, hash-verified

3160 '''))
3161
3162 def test_groups_parents(self):
3163 parent = ErrorRaisingArgumentParser(add_help=False)
3164 g = parent.add_argument_group(title='g', description='gd')
3165 g.add_argument('-w')
3166 g.add_argument('-x')
3167 m = parent.add_mutually_exclusive_group()
3168 m.add_argument('-y')
3169 m.add_argument('-z')
3170 parser = ErrorRaisingArgumentParser(prog='PROG', parents=[parent])
3171
3172 self.assertRaises(ArgumentParserError, parser.parse_args,
3173 ['-y', 'Y', '-z', 'Z'])
3174
3175 parser_help = parser.format_help()
3176 self.assertEqual(parser_help, textwrap.dedent('''\
3177 usage: PROG [-h] [-w W] [-x X] [-y Y | -z Z]
3178
3179 options:
3180 -h, --help show this help message and exit
3181 -y Y
3182 -z Z
3183
3184 g:
3185 gd
3186
3187 -w W
3188 -x X
3189 '''))
3190
3191 def test_wrong_type_parents(self):
3192 self.assertRaises(TypeError, ErrorRaisingArgumentParser, parents=[1])

Callers

nothing calls this directly

Calls 8

dedentMethod · 0.80
add_argument_groupMethod · 0.45
add_argumentMethod · 0.45
assertRaisesMethod · 0.45
format_helpMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected