MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_asend

Method test_asend

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

Source from the content-addressed store, hash-verified

2010class TestUnawaitedWarnings(unittest.TestCase):
2011 @unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: RuntimeWarning not triggered
2012 def test_asend(self):
2013 async def gen():
2014 yield 1
2015
2016 # gh-113753: asend objects allocated from a free-list should warn.
2017 # Ensure there is a finalized 'asend' object ready to be reused.
2018 try:
2019 g = gen()
2020 g.asend(None).send(None)
2021 except StopIteration:
2022 pass
2023
2024 msg = f"coroutine method 'asend' of '{gen.__qualname__}' was never awaited"
2025 with self.assertWarnsRegex(RuntimeWarning, msg):
2026 g = gen()
2027 g.asend(None)
2028 gc_collect()
2029
2030 @unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: RuntimeWarning not triggered
2031 def test_athrow(self):

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