MCPcopy
hub / github.com/pyodide/pyodide / test_async_gen2

Function test_async_gen2

src/tests/test_pyproxy.py:1730–1748  ·  view source on GitHub ↗
(selenium)

Source from the content-addressed store, hash-verified

1728
1729@run_in_pyodide
1730async def test_async_gen2(selenium):
1731 from pyodide.code import run_js
1732
1733 async def g():
1734 for n in range(3):
1735 yield n
1736
1737 p = run_js(
1738 """
1739 async (g) => {
1740 let result = [];
1741 for await (let x of g){
1742 result.push(x);
1743 }
1744 return result;
1745 }
1746 """
1747 )(g())
1748 assert (await p).to_py() == [0, 1, 2]
1749
1750
1751@run_in_pyodide

Callers

nothing calls this directly

Calls 3

run_jsFunction · 0.90
gFunction · 0.70
to_pyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…