예제 #1
0
def test_option_some_bind_none_fluent():
    xs = Some(42)
    ys = xs.bind(lambda x: Nothing)

    for _ in ys.match(Nothing):
        assert True
        break
    else:
        assert False
예제 #2
0
def test_option_some_bind_fluent():
    xs = Some(42)
    ys = xs.bind(lambda x: Some(x + 1))

    for value in ys.match(Some):
        assert value == 43
        break
    else:
        assert False