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