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

Method test_subparser_conflict

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

Source from the content-addressed store, hash-verified

5958 '''))
5959
5960 def test_subparser_conflict(self):
5961 parser = argparse.ArgumentParser()
5962 sp = parser.add_subparsers()
5963 sp.add_parser('fullname', aliases=['alias'])
5964 self.assertRaisesRegex(ValueError,
5965 'conflicting subparser: fullname',
5966 sp.add_parser, 'fullname')
5967 self.assertRaisesRegex(ValueError,
5968 'conflicting subparser: alias',
5969 sp.add_parser, 'alias')
5970 self.assertRaisesRegex(ValueError,
5971 'conflicting subparser alias: fullname',
5972 sp.add_parser, 'other', aliases=['fullname'])
5973 self.assertRaisesRegex(ValueError,
5974 'conflicting subparser alias: alias',
5975 sp.add_parser, 'other', aliases=['alias'])
5976
5977
5978# =============================

Callers

nothing calls this directly

Calls 3

add_subparsersMethod · 0.95
add_parserMethod · 0.80
assertRaisesRegexMethod · 0.80

Tested by

no test coverage detected