mirror of
https://github.com/correl/typesafe-monads.git
synced 2024-11-28 19:19:55 +00:00
18 lines
372 B
Python
18 lines
372 B
Python
|
from monads.maybe import Just, Nothing, maybe
|
||
|
|
||
|
|
||
|
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)
|