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

Method test_mixed

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

Source from the content-addressed store, hash-verified

6385 self.assertEqual(['--bar', '--baz'], extras)
6386
6387 def test_mixed(self):
6388 parser = argparse.ArgumentParser()
6389 parser.add_argument('-v', nargs='?', const=1, type=int)
6390 parser.add_argument('--spam', action='store_false')
6391 parser.add_argument('badger')
6392
6393 argv = ["B", "C", "--foo", "-v", "3", "4"]
6394 args, extras = parser.parse_known_args(argv)
6395 self.assertEqual(NS(v=3, spam=True, badger="B"), args)
6396 self.assertEqual(["C", "--foo", "4"], extras)
6397
6398 def test_zero_or_more_optional(self):
6399 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