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

Method test_asend

Lib/test/test_asyncgen.py:1996–2012  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1994
1995class TestUnawaitedWarnings(unittest.TestCase):
1996 def test_asend(self):
1997 async def gen():
1998 yield 1
1999
2000 # gh-113753: asend objects allocated from a free-list should warn.
2001 # Ensure there is a finalized 'asend' object ready to be reused.
2002 try:
2003 g = gen()
2004 g.asend(None).send(None)
2005 except StopIteration:
2006 pass
2007
2008 msg = f"coroutine method 'asend' of '{gen.__qualname__}' was never awaited"
2009 with self.assertWarnsRegex(RuntimeWarning, msg):
2010 g = gen()
2011 g.asend(None)
2012 gc_collect()
2013
2014 def test_athrow(self):
2015 async def gen():

Callers

nothing calls this directly

Calls 5

gc_collectFunction · 0.90
assertWarnsRegexMethod · 0.80
genFunction · 0.70
sendMethod · 0.45
asendMethod · 0.45

Tested by

no test coverage detected