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

Method test_optional_subparsers

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

Source from the content-addressed store, hash-verified

2682 )
2683
2684 def test_optional_subparsers(self):
2685 parser = ErrorRaisingArgumentParser()
2686 subparsers = parser.add_subparsers(dest='command', required=False)
2687 subparsers.add_parser('run')
2688 # No error here
2689 ret = parser.parse_args(())
2690 self.assertIsNone(ret.command)
2691
2692 def test_help(self):
2693 self.assertEqual(self.parser.format_usage(),

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