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

Method test_mixed

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

Source from the content-addressed store, hash-verified

6504 self.assertEqual(['--bar', '--baz'], extras)
6505
6506 def test_mixed(self):
6507 parser = argparse.ArgumentParser()
6508 parser.add_argument('-v', nargs='?', const=1, type=int)
6509 parser.add_argument('--spam', action='store_false')
6510 parser.add_argument('badger')
6511
6512 argv = ["B", "C", "--foo", "-v", "3", "4"]
6513 args, extras = parser.parse_known_args(argv)
6514 self.assertEqual(NS(v=3, spam=True, badger="B"), args)
6515 self.assertEqual(["C", "--foo", "4"], extras)
6516
6517 def test_zero_or_more_optional(self):
6518 parser = argparse.ArgumentParser()

Callers

nothing calls this directly

Calls 4

parse_known_argsMethod · 0.95
NSClass · 0.70
add_argumentMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected