def test_Nothing_filter(): assert Nothing.filter(lambda x: x > 4) is Nothing
def test_Nothing_get_or(): assert Nothing.get_or(3) == 3
def test_Nothing_fmap(): assert Nothing.fmap(add_two) is Nothing
def test_Nothing_apply(): assert Nothing.apply(add_two) is Nothing
def test_Maybe_to_Either(): assert Just(4).to_either(None) == Right(4) assert Nothing.to_either('failure') == Left('failure')
def test_Nothing_chain_many(): x = Nothing.or_call(add_two, 2).filter(lambda x: x & 1) assert x is Nothing
def test_Nothing_or_call(): assert Nothing.or_call(add_two, 2) == Just(4)
def test_Nothing_or_else(): assert Nothing.or_else(4) == Just(4)
def test_Nothing_get_or_call(): assert Nothing.get_or_call(add_two, 2) == 4