typesafe-monads/tests/test_maybe.py

18 lines
379 B
Python
Raw Normal View History

from monads.maybe import Maybe, Just, Nothing, maybe
2018-10-11 05:26:00 +00:00
def test_maybe_none():
assert isinstance(maybe(None), Nothing)
def test_maybe_something():
assert isinstance(maybe(False), Just)
def test_maybe_boolean_false():
assert isinstance(maybe(False, predicate=bool), Nothing)
def test_maybe_boolean_true():
assert isinstance(maybe(True, predicate=bool), Just)