def test_copy_warns_if_dependencies_in_active_flow(self): t1 = Task() t2 = Task() with Flow(name="test"): t1.set_dependencies(downstream_tasks=[t2]) with pytest.warns(UserWarning): t1.copy() with Flow(name="test"): # no dependencies in this flow t1.copy()
def test_copy_warns_if_dependencies_in_active_flow(self): t1 = Task() t2 = Task() with Flow(name="test") as flow: t1.set_dependencies(downstream_tasks=[t2]) with pytest.warns(UserWarning, match="You are making a copy"): flow.add_task(t1.copy()) with Flow(name="test") as flow: with pytest.warns(None) as rec: flow.add_task(t1.copy()) # no dependencies in this flow assert len(rec) == 0
def test_automatic_create_constant_task(self): with Flow(name="test") as flow: t = Task() t.set_dependencies(upstream_tasks=[4]) assert len(flow.tasks) == 2 assert any(isinstance(t, Constant) for t in flow.tasks)