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

Method test

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

Source from the content-addressed store, hash-verified

2328 setattr(namespace, self.dest, 'foo[%s]' % values)
2329
2330 def test(self):
2331
2332 parser = argparse.ArgumentParser()
2333 parser.register('action', 'my_action', self.MyAction)
2334 parser.add_argument('badger', action='my_action')
2335
2336 self.assertEqual(parser.parse_args(['1']), NS(badger='foo[1]'))
2337 self.assertEqual(parser.parse_args(['42']), NS(badger='foo[42]'))
2338
2339
2340class TestActionExtend(ParserTestCase):

Callers

nothing calls this directly

Calls 5

parse_argsMethod · 0.95
NSClass · 0.70
registerMethod · 0.45
add_argumentMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected