def test_env_clear_free_ids(): env = EvaluationEnvironment() eid0 = env.current_execution() env.new_execution() env.clear() assert env.current_execution() == eid0
def test_lazy_always_reevaluate_if_inputs_changed(): evaluated = [] def func(txt): evaluated.append(txt) return txt pg = PortGraph() vid = pg.add_actor(FuncNode(func)) assert pg.actor(vid).is_lazy() algo = LazyEvaluation(pg) env = EvaluationEnvironment() ws = WorkflowState(pg) ws.store_param(pg.in_port(vid, 'txt'), 'toto', env.current_execution()) algo.eval(env, ws) assert len(evaluated) == 1 env.new_execution() ws.store_param(pg.in_port(vid, 'txt'), 'toto', env.current_execution()) algo.eval(env, ws) assert len(evaluated) == 2
def test_env_created_with_proper_id(): env = EvaluationEnvironment() assert env.current_execution() is not None env = EvaluationEnvironment(1) assert env.current_execution() == 1
def test_env_new_execution(): env = EvaluationEnvironment() eid0 = env.current_execution() env.new_execution() assert env.current_execution() != eid0