Skip to content

Commit

Permalink
feat: add AnyResult new alias (#26)
Browse files Browse the repository at this point in the history
* feat: add AnyResult new alias

* chore(tests): add some additional alias tests
  • Loading branch information
acostapazo authored Aug 8, 2022
1 parent 711e351 commit f32b412
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion meiga/alias.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Generic, cast
from typing import Any, Generic, cast

from meiga.error import Error
from meiga.result import TF, TS, Result
Expand All @@ -19,3 +19,4 @@ def __init__(self, error: TF = cast(TF, Error())) -> None:
NotImplementedMethodError = isFailure

BoolResult = Result[bool, Error]
AnyResult = Result[Any, Error]
2 changes: 2 additions & 0 deletions meiga/public_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from . import decorators
from .alias import (
AnyResult,
BoolResult,
Failure,
NotImplementedMethodError,
Expand All @@ -26,6 +27,7 @@
"isFailure",
"NotImplementedMethodError",
"BoolResult",
"AnyResult",
"OnSuccessHandler",
"OnFailureHandler",
]
6 changes: 6 additions & 0 deletions tests/unit/test_alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,9 @@ def should_unwrap_a_given_type_value(self, value):

assert type(result.unwrap()) is type(value)
assert type(success.unwrap()) is type(value)

def should_check_bool_result_is_available_in_the_public_api(self):
from meiga import BoolResult # noqa

def should_check_any_result_is_available_in_the_public_api(self):
from meiga import AnyResult # noqa

0 comments on commit f32b412

Please sign in to comment.