def test_right_bind_calls_with_value_other_type(self) -> None: def f(x: _T) -> Either[_U, str]: return Right('yay') assert Right(1).bind(f) == Right('yay') assert (Right(1) >> f) == Right('yay')
def f(x: _T) -> Either[_U, str]: return Right('yay')
def inc(x: int) -> Either[_T, int]: return Right(x + 1)
def test_right_bind_calls_with_value(self) -> None: def inc(x: int) -> Either[_T, int]: return Right(x + 1) assert Right(1).bind(inc) == Right(2) assert (Right(1) >> inc) == Right(2)
def test_right(self) -> None: assert Right(42).__repr__() == 'Right(42)'
def test_right_fmap_calls_with_value_other_type(self) -> None: assert Right(1).fmap(lambda x: 'yay') == Right('yay')
def test_right_fmap_calls_with_value(self) -> None: assert Right(1).fmap(lambda x: x + 1) == Right(2)