mirror of
https://github.com/correl/typesafe-monads.git
synced 2024-11-24 11:09:58 +00:00
Add missing result test
This commit is contained in:
parent
90b2ec49ef
commit
7608fa40fe
2 changed files with 7 additions and 2 deletions
|
@ -18,7 +18,7 @@ class Monad(Applicative[T]):
|
|||
raise NotImplementedError
|
||||
|
||||
@classmethod
|
||||
def pure(cls, value: T) -> Monad[T]:
|
||||
def pure(cls, value: T) -> Monad[T]: # pragma: no cover
|
||||
raise NotImplementedError
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -63,11 +63,16 @@ def test_map_infix() -> None:
|
|||
assert "5" == mapped.withDefault("0")
|
||||
|
||||
|
||||
def test_map_error() -> None:
|
||||
def test_map_error_err() -> None:
|
||||
m: Result[int, str] = Err("oops")
|
||||
assert Err(4) == m.mapError(len)
|
||||
|
||||
|
||||
def test_map_error_ok() -> None:
|
||||
m: Result[int, str] = Ok(123)
|
||||
assert Ok(123) == m.mapError(len)
|
||||
|
||||
|
||||
def test_bind() -> None:
|
||||
result: Result[int, str] = Ok(5)
|
||||
incremented: Result[int, str] = result.bind(lambda x: Ok(x + 1))
|
||||
|
|
Loading…
Reference in a new issue