-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add most trivial possible test suite, and pass it
- Loading branch information
Showing
3 changed files
with
30 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from functools import partial | ||
import trio | ||
from trimeter import run_on_each, amap, run_all | ||
|
||
# Just the most basic smoke test of the three functions | ||
async def test_basics(): | ||
ran_on = [] | ||
|
||
async def afn(value): | ||
ran_on.append(value) | ||
return value + 1 | ||
|
||
await run_on_each(afn, [1, 2, 3]) | ||
|
||
assert sorted(ran_on) == [1, 2, 3] | ||
|
||
async with amap(afn, [1, 2, 3]) as result_channel: | ||
results = [] | ||
async for result in result_channel: | ||
results.append(result) | ||
assert sorted(results) == [2, 3, 4] | ||
|
||
results = await run_all([ | ||
partial(afn, 10), | ||
partial(afn, 11), | ||
partial(afn, 12), | ||
]) | ||
assert results == [11, 12, 13] |
This file was deleted.
Oops, something went wrong.