-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consider it as a part of hometask from @BartoszMilewski and @hmemcpy defined at: https://github.com/hmemcpy/milewski-ctfp-pdf/blob/681c9cd62b5ec8169ca86b46f54b46ff3fc3802c/src/content/1.1/category-the-essence-of-composition.tex#L255-L257 It is also benefitial to our end users as well.
- Loading branch information
Showing
6 changed files
with
65 additions
and
1 deletion.
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
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 |
---|---|---|
|
@@ -10,4 +10,4 @@ m2r==0.2.1 | |
tomlkit==0.5.3 | ||
|
||
# Dependencies of our project: | ||
typing-extensions==3.7.2. | ||
typing-extensions==3.7.2 |
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
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,19 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from returns.functions import compose | ||
|
||
|
||
def _first(a: int) -> str: | ||
return str(a) | ||
|
||
|
||
def _second(b: str) -> bool: | ||
return bool(b) | ||
|
||
|
||
def test_function_composition(): | ||
"""Ensures that functions can be composed and return type is correct.""" | ||
second_after_first = compose(_first, _second) | ||
|
||
assert second_after_first(1) is True | ||
assert second_after_first(0) is True |