def test_map_iterates_over_multiple_args(self): def map_fn(x, y): return x + y e = SynchronousExecutor() with e.start(): res = e.wait(e.map(map_fn, [1, 2], [1, 3])) assert res == [2, 5]
def test_map_doesnt_do_anything_for_empty_list_input(self): def map_fn(*args): raise ValueError("map_fn was called") e = SynchronousExecutor() with e.start(): res = e.wait(e.map(map_fn)) assert res == []
def test_wait(self): e = SynchronousExecutor() assert e.wait(1) == 1 assert e.wait(prefect) is prefect assert e.wait(e.submit(lambda: 1)) == 1 assert e.wait(e.submit(lambda x: x, 1)) == 1 assert e.wait(e.submit(lambda x: x, x=1)) == 1 assert e.wait(e.submit(lambda: prefect)) is prefect