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

Method test_invocation

Lib/test/test_dis.py:2559–2583  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2557 self.assertListEqual(res.splitlines(), expect.splitlines())
2558
2559 def test_invocation(self):
2560 # test various combinations of parameters
2561 base_flags = [
2562 ('-C', '--show-caches'),
2563 ('-O', '--show-offsets'),
2564 ('-P', '--show-positions'),
2565 ('-S', '--specialized'),
2566 ]
2567
2568 self.set_source('''
2569 def f():
2570 print(x)
2571 return None
2572 ''')
2573
2574 for r in range(1, len(base_flags) + 1):
2575 for choices in itertools.combinations(base_flags, r=r):
2576 for args in itertools.product(*choices):
2577 with self.subTest(args=args[1:]):
2578 _ = self.invoke_dis(*args)
2579
2580 with self.assertRaises(SystemExit):
2581 # suppress argparse error message
2582 with contextlib.redirect_stderr(io.StringIO()):
2583 _ = self.invoke_dis('--unknown')
2584
2585 def test_show_cache(self):
2586 # test 'python -m dis -C/--show-caches'

Callers

nothing calls this directly

Calls 5

set_sourceMethod · 0.95
invoke_disMethod · 0.95
lenFunction · 0.85
subTestMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected