summaryrefslogtreecommitdiffstats
path: root/lang/python/python-trio/test.sh
blob: 5a3c68bfc20d7447a2a86cb9bf1b2da28aa1fc92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

[ "$1" = python3-trio ] || exit 0

python3 - << 'EOF'
import trio

results = []

async def worker(n):
    await trio.sleep(0)
    results.append(n)

async def main():
    async with trio.open_nursery() as nursery:
        for i in range(3):
            nursery.start_soon(worker, i)

trio.run(main)
assert sorted(results) == [0, 1, 2], f"Expected [0,1,2], got {results}"

print("python3-trio OK")
EOF