mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
GH-123044: Give the POP_TOP after a case test a location in the body, not the pattern. (GH-130627)
This commit is contained in:
parent
91d6db7ee0
commit
be046ee6e0
6 changed files with 52 additions and 6 deletions
|
|
@ -1681,6 +1681,35 @@ class TestBranchAndJumpEvents(CheckEvents):
|
|||
('branch left', 'func', 12, 12)])
|
||||
|
||||
|
||||
def test_match(self):
|
||||
|
||||
def func(v=1):
|
||||
x = 0
|
||||
for v in range(4):
|
||||
match v:
|
||||
case 1:
|
||||
x += 1
|
||||
case 2:
|
||||
x += 2
|
||||
case _:
|
||||
x += 3
|
||||
return x
|
||||
|
||||
self.check_events(func, recorders = BRANCHES_RECORDERS, expected = [
|
||||
('branch left', 'func', 2, 2),
|
||||
('branch right', 'func', 4, 6),
|
||||
('branch right', 'func', 6, 8),
|
||||
('branch left', 'func', 2, 2),
|
||||
('branch left', 'func', 4, 5),
|
||||
('branch left', 'func', 2, 2),
|
||||
('branch right', 'func', 4, 6),
|
||||
('branch left', 'func', 6, 7),
|
||||
('branch left', 'func', 2, 2),
|
||||
('branch right', 'func', 4, 6),
|
||||
('branch right', 'func', 6, 8),
|
||||
('branch right', 'func', 2, 10)])
|
||||
|
||||
|
||||
class TestBranchConsistency(MonitoringTestBase, unittest.TestCase):
|
||||
|
||||
def check_branches(self, run_func, test_func=None, tool=TEST_TOOL, recorders=BRANCH_OFFSET_RECORDERS):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue