-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unwrap feature to Result object. Add cache for pip requirements i…
…n github action. Add pre-commit config file
- Loading branch information
1 parent
8faf748
commit f9133f3
Showing
5 changed files
with
47 additions
and
10 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 was deleted.
Oops, something went wrong.
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,21 @@ | ||
import pytest | ||
|
||
from meiga import Result, Error, Failure | ||
|
||
|
||
@pytest.mark.unit | ||
def test_should_return_the_value_when_unwrap_a_success_result(): | ||
|
||
result = Result(success="Hi!") | ||
value = result.unwrap() | ||
|
||
assert value == "Hi!" | ||
|
||
|
||
@pytest.mark.unit | ||
def test_should_return_none_when_unwrap_a_failure_result(): | ||
|
||
result = Failure(Error()) | ||
value = result.unwrap() | ||
|
||
assert value is None |