コード例 #1
0
def _maybe_pipeline(number: int) -> Maybe[int]:
    first: int = Some(number).unwrap() if number else Nothing.unwrap()
    return Some(first + number)
コード例 #2
0
ファイル: test_maybe_unwrap.py プロジェクト: zeta1999/returns
def test_unwrap_failure():
    """Ensures that unwrap works for Nothing container."""
    with pytest.raises(UnwrapFailedError):
        assert Nothing.unwrap()