Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cjao committed Dec 13, 2023
1 parent 2694e08 commit 651f2ee
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
28 changes: 20 additions & 8 deletions tests/covalent_tests/workflow/electron_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,18 +396,30 @@ def workflow(x):
g = workflow.transport_graph._graph

# Account for postprocessing node
assert list(g.nodes) == [0, 1, 2, 3, 4]
assert list(g.nodes) == [0, 1, 2, 3, 4, 5, 6, 7, 8]
fn = g.nodes[1]["function"].get_deserialized()
assert fn(x=2, y=5, z=7) == {"x": 2, "y": 5, "z": 7}
assert g.nodes[2]["value"].get_deserialized() == 5
assert g.nodes[3]["value"].get_deserialized() == 7
assert fn(["x", "y", "z"], [2, 5, 7]) == {"x": 2, "y": 5, "z": 7}
fn = g.nodes[2]["function"].get_deserialized()
assert fn("x", "y") == ["x", "y"]
keys = [g.nodes[3]["value"].get_deserialized(), g.nodes[4]["value"].get_deserialized()]
fn = g.nodes[5]["function"].get_deserialized()
assert fn(2, 3) == [2, 3]
vals = [g.nodes[6]["value"].get_deserialized(), g.nodes[7]["value"].get_deserialized()]
assert keys == ["x", "y"]
assert vals == [5, 7]
assert set(g.edges) == {
(1, 0, 0),
(2, 1, 0),
(3, 1, 0),
(0, 4, 0),
(0, 4, 1),
(1, 4, 0),
(3, 2, 0),
(4, 2, 0),
(5, 1, 0),
(6, 5, 0),
(7, 5, 0),
(0, 8, 0),
(0, 8, 1),
(1, 8, 0),
(2, 8, 0),
(5, 8, 0),
}


Expand Down
3 changes: 2 additions & 1 deletion tests/functional_tests/workflow_stack_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,8 @@ def workflow(x):
res_1 = sum_values(x)
return square(res_1)

dispatch_id = ct.dispatch(workflow)({"x": 1, "y": 2, "z": 3})
# Check that non-string keys are allowed
dispatch_id = ct.dispatch(workflow)({"x": 1, "y": 2, 3: 3})

res_obj = rm.get_result(dispatch_id, wait=True)

Expand Down

0 comments on commit 651f2ee

Please sign in to comment.