Skip to content

Commit 7ed87b2

Browse files
authored
Use str equality as final step for computation graph builder tests
Show graphs on mismatch in tests
2 parents 279fe0a + 2896d30 commit 7ed87b2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/test_graph_builder.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,12 @@ def test_graph_builder_rebuilds_pt(pt_path):
5050

5151
assert len(list(rebuilt.parameters())) == len(expected_edges)
5252
assert len(rebuilt.node_types) == len(data.node_types)
53+
54+
# Verify that the rebuilt computation graph is identical to the original
55+
if str(rebuilt.graph) != str(original.graph):
56+
print("Original graph:\n", original.graph)
57+
print("Rebuilt graph:\n", rebuilt.graph)
58+
assert str(rebuilt.graph) == str(original.graph), (
59+
"\nOriginal graph:\n" + str(original.graph) +
60+
"\nRebuilt graph:\n" + str(rebuilt.graph)
61+
)

0 commit comments

Comments
 (0)