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