def test_filter_generator(self): e = effect.filter_( lambda v: effect.success(v % 2 == 0), (v for v in range(5)) ) assert e.run(None) == (0, 2, 4) assert e.run(None) == (0, 2, 4)
def test_filter_repr(self): f = lambda _: effect.success(True) assert repr(effect.filter_(f, [0])) == f'filter_({repr(f)})((0,))'
def test_filter(self): assert effect.filter_(lambda v: effect.success(v % 2 == 0), range(5)).run(None) == (0, 2, 4)