-
-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Just a concept of gather-like method #1966
base: master
Are you sure you want to change the base?
Changes from 1 commit
e09e762
dffe4f7
e858b8b
d1920b0
4b0f707
e959624
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
import pytest | ||
|
||
from returns.future import Future, FutureResult | ||
from returns.io import IO, IOResult | ||
from returns.methods import gather | ||
|
||
|
||
@pytest.mark.parametrize(('containers', 'expected'), [ | ||
( | ||
( | ||
Future.from_value(1), | ||
FutureResult.from_value(2), | ||
FutureResult.from_failure(None), | ||
), | ||
(IO(1), IOResult.from_value(2), FutureResult.from_failure(None)), | ||
), | ||
((), ()), | ||
]) | ||
def test_gather(containers, expected): | ||
"""Test partition function.""" | ||
assert gather(containers) == expected | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should not be possible. You cannot mix There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (from mypy's point of view, I mean) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is not supposed to mix IO operations that can and can not fail? Or it is just mypy limitation? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's create a new file:
async_.py
and put it there.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is naming of the method good(gather)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeap