(self)
| 1994 | |
| 1995 | class 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(): |
nothing calls this directly
no test coverage detected