Beispiel #1
0
def test_unwrap():
    o = Ok('yay')
    n = Err('nay')
    assert o.unwrap() == 'yay'
    with pytest.raises(UnwrapError):
        n.unwrap()
Beispiel #2
0
def test_error_context():
    n = Err('nay')
    with pytest.raises(UnwrapError) as e:
        n.unwrap()
    assert e.value.result is n