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

Method test_effect_sizes

Lib/test/test_generated_cases.py:56–76  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

54
55class TestEffects(unittest.TestCase):
56 def test_effect_sizes(self):
57 stack = Stack()
58 inputs = [
59 x := StackItem("x", "1"),
60 y := StackItem("y", "oparg"),
61 z := StackItem("z", "oparg*2"),
62 ]
63 outputs = [
64 StackItem("x", "1"),
65 StackItem("b", "oparg*4"),
66 StackItem("c", "1"),
67 ]
68 null = CWriter.null()
69 stack.pop(z, null)
70 stack.pop(y, null)
71 stack.pop(x, null)
72 for out in outputs:
73 stack.push(Local.undefined(out))
74 self.assertEqual(stack.base_offset.to_c(), "-1 - oparg - oparg*2")
75 self.assertEqual(stack.physical_sp.to_c(), "0")
76 self.assertEqual(stack.logical_sp.to_c(), "1 - oparg - oparg*2 + oparg*4")
77
78
79class TestGeneratedCases(unittest.TestCase):

Callers

nothing calls this directly

Calls 8

popMethod · 0.95
pushMethod · 0.95
StackClass · 0.90
StackItemClass · 0.90
undefinedMethod · 0.80
to_cMethod · 0.80
nullMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected