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

Method test_send_with

Lib/test/test_opcache.py:1584–1607  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1582 @cpython_only
1583 @requires_specialization
1584 def test_send_with(self):
1585 def run_async(coro):
1586 while True:
1587 try:
1588 coro.send(None)
1589 except StopIteration:
1590 break
1591
1592 class CM:
1593 async def __aenter__(self):
1594 return self
1595
1596 async def __aexit__(self, *exc):
1597 pass
1598
1599 async def send_with():
1600 for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD):
1601 async with CM():
1602 x = 1
1603
1604 run_async(send_with())
1605 # Note there are still unspecialized "SEND" opcodes in the
1606 # cleanup paths of the 'with' statement.
1607 self.assert_specialized(send_with, "SEND_GEN")
1608
1609 @cpython_only
1610 @requires_specialization

Callers

nothing calls this directly

Calls 2

run_asyncFunction · 0.85
assert_specializedMethod · 0.80

Tested by

no test coverage detected