mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
GH-128534: Instrument branches for async for loops. (GH-130569)
This commit is contained in:
parent
fda056e64b
commit
2a18e80695
11 changed files with 140 additions and 35 deletions
|
|
@ -1657,6 +1657,29 @@ class TestBranchAndJumpEvents(CheckEvents):
|
|||
in_loop,
|
||||
exit_loop])
|
||||
|
||||
def test_async_for(self):
|
||||
|
||||
def func():
|
||||
async def gen():
|
||||
yield 2
|
||||
yield 3
|
||||
|
||||
async def foo():
|
||||
async for y in gen():
|
||||
2
|
||||
pass # line 3
|
||||
|
||||
try:
|
||||
foo().send(None)
|
||||
except StopIteration:
|
||||
pass
|
||||
|
||||
self.check_events(func, recorders = BRANCHES_RECORDERS, expected = [
|
||||
('branch left', 'foo', 1, 1),
|
||||
('branch left', 'foo', 1, 1),
|
||||
('branch right', 'foo', 1, 3),
|
||||
('branch left', 'func', 12, 12)])
|
||||
|
||||
|
||||
class TestBranchConsistency(MonitoringTestBase, unittest.TestCase):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue