예제 #1
0
def test_and_then_with_ok_and_then_err():
    x = Ok(2)

    assert x.and_then(lambda x: Err(Exception(x + 1))) == Err(Exception(3))
예제 #2
0
def test_and_then_with_ok():
    x = Ok(2)

    assert x.and_then(lambda x: Ok(x**2)) == Ok(4)