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

Method test_parse_args

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

Source from the content-addressed store, hash-verified

2529 self.assertEqual(cm.exception.args[2], f'{usage_str}\n{error_str}\n')
2530
2531 def test_parse_args(self):
2532 # check some non-failure cases:
2533 self.assertEqual(
2534 self.parser.parse_args('0.5 1 b -w 7'.split()),
2535 NS(foo=False, bar=0.5, w=7, x='b'),
2536 )
2537 self.assertEqual(
2538 self.parser.parse_args('0.25 --foo 2 -y 2 3j -- -1j'.split()),
2539 NS(foo=True, bar=0.25, y='2', z=[3j, -1j]),
2540 )
2541 self.assertEqual(
2542 self.parser.parse_args('--foo 0.125 1 c'.split()),
2543 NS(foo=True, bar=0.125, w=None, x='c'),
2544 )
2545 self.assertEqual(
2546 self.parser.parse_args('-1.5 3 11 -- a --foo 7 -- b'.split()),
2547 NS(foo=False, bar=-1.5, t=11, u=['a', '--foo', '7', '--', 'b']),
2548 )
2549
2550 def test_parse_known_args(self):
2551 self.assertEqual(

Callers

nothing calls this directly

Calls 4

NSClass · 0.70
assertEqualMethod · 0.45
parse_argsMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected