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