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

Method test_optimized

Lib/test/test_peepholer.py:2431–2456  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2429 consts=insts_consts, expected_consts=exp_consts)
2430
2431 def test_optimized(self):
2432 insts = [
2433 ("LOAD_FAST", 0, 1),
2434 ("LOAD_FAST", 1, 2),
2435 ("BINARY_OP", 2, 3),
2436 ]
2437 expected = [
2438 ("LOAD_FAST_BORROW", 0, 1),
2439 ("LOAD_FAST_BORROW", 1, 2),
2440 ("BINARY_OP", 2, 3),
2441 ]
2442 self.check(insts, expected)
2443
2444 insts = [
2445 ("LOAD_FAST", 0, 1),
2446 ("LOAD_CONST", 1, 2),
2447 ("SWAP", 2, 3),
2448 ("POP_TOP", None, 4),
2449 ]
2450 expected = [
2451 ("LOAD_FAST_BORROW", 0, 1),
2452 ("LOAD_CONST", 1, 2),
2453 ("SWAP", 2, 3),
2454 ("POP_TOP", None, 4),
2455 ]
2456 self.check(insts, expected)
2457
2458 def test_unoptimized_if_unconsumed(self):
2459 insts = [

Callers

nothing calls this directly

Calls 1

checkMethod · 0.95

Tested by

no test coverage detected