def test_apply_with_context_ioresult(): """Ensures that functions can be composed and return type is correct.""" applied = apply(RequiresContextIOResult.from_value(_function)) assert applied(RequiresContextIOResult.from_value(1), )( ...) == IOSuccess('2')
def test_apply_with_context(): """Ensures that functions can be composed and return type is correct.""" applied = apply(RequiresContext.from_value(_function)) assert applied(RequiresContext.from_value(1))(...) == '2'
def test_apply_with_maybe(): """Ensures that functions can be composed and return type is correct.""" applied = apply(Maybe.from_value(_function)) assert applied(Some(1)) == Some('2') assert applied(Nothing) == Nothing
def test_apply_with_result(): """Ensures that functions can be composed and return type is correct.""" applied = apply(Result.from_value(_function)) assert applied(Success(1)) == Success('2') assert applied(Failure('s')) == Failure('s')
def test_apply_with_io(): """Ensures that functions can be composed and return type is correct.""" assert apply(IO(_function))(IO(1)) == IO('2')