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

Method test_optional_subparsers

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

Source from the content-addressed store, hash-verified

2783 )
2784
2785 def test_optional_subparsers(self):
2786 parser = ErrorRaisingArgumentParser()
2787 subparsers = parser.add_subparsers(dest='command', required=False)
2788 subparsers.add_parser('run')
2789 # No error here
2790 ret = parser.parse_args(())
2791 self.assertIsNone(ret.command)
2792
2793 def test_subparser_help_with_parent_required_optional(self):
2794 parser = ErrorRaisingArgumentParser(prog='PROG')

Callers

nothing calls this directly

Calls 5

parse_argsMethod · 0.95
add_subparsersMethod · 0.80
add_parserMethod · 0.80
assertIsNoneMethod · 0.80

Tested by

no test coverage detected