Skip to content

Commit d3ca9e2

Browse files
committed
🔧 fix parallel example
1 parent da37a00 commit d3ca9e2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

examples/parallel.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44

55

66
async def main():
7-
await asyncio.gather(spawn_codebox() for _ in range(10))
7+
await asyncio.gather(*(spawn_codebox() for _ in range(10)))
88

99

1010
async def spawn_codebox():
1111
async with CodeBox() as codebox:
12-
print(await codebox.arun("print('Hello World!')"))
12+
await codebox.arun("a = 'Hello World!'")
13+
a = await codebox.arun("a")
14+
assert a == "Hello World!"
15+
print("Success!")
1316

1417

1518
if __name__ == "__main__":

0 commit comments

Comments
 (0)