def test_copy(self): """Test that we can produce a copy of a Workflow but that the copy has unique fw_ids. """ fws = [] for i in range(5): fw = Firework([PyTask(func="print", args=[i])], fw_id=i, name=i) fws.append(fw) wf = Workflow(fws, links_dict={0: [1, 2, 3], 1: [4], 2: [4]}) wf_copy = Workflow.from_wflow(wf) # now we compare to the original to make sure dependencies are same. # have to do gymnastics because ids will NOT be the same # but names are retained for fw in wf_copy.fws: children = wf_copy.links.get(fw.fw_id, list()) orig_id = fw.name orig_children = wf.links.get(orig_id, list()) for child_id, orig_child_id in zip(children, orig_children): self.assertEqual(orig_child_id, wf_copy.id_fw[child_id].name)