def test_filter(self): assert filter_(lambda v: Done(v % 2 == 0), range(3)).run() == (0, 2)
def test_sequence(self): assert sequence([Done(v) for v in range(3)]).run() == (0, 1, 2)
def test_stack_safety(self): with recursion_limit(100): sequence([Done(v) for v in range(500)]).run()
def test_composition_law(self, f, g, value): h = compose(f, g) assert Done(value).map(g).map(f).run() == Done(value).map(h).run()
def test_identity_law(self, value): assert Done(value).map(identity).run() == Done(value).run()
def test_inequality(self, first, second): assume(first != second) assert Done(first) != Done(second)
def test_equality(self, value): assert Done(value) == Done(value)
def test_left_identity_law(self, value, f): assert Done(value).and_then(f).run() == f(value).run()