Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #600 from Jaseci-Labs/dot_edge_attr
Browse files Browse the repository at this point in the history
Enhance the dot view by displaying edge attributes.
  • Loading branch information
marsninja authored Sep 3, 2024
2 parents 9690cf9 + f15b772 commit 13a4dda
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jaclang/plugin/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ def dfs(node: NodeArchitype, cur_depth: int) -> None:
for source, target, edge in connections:
dot_content += (
f"{visited_nodes.index(source)} -> {visited_nodes.index(target)} "
f' [label="{html.escape(str(edge.__jac__.architype.__class__.__name__))} "];\n'
f' [label="{html.escape(str(edge.__jac__.architype))} "];\n'
)
for node_ in visited_nodes:
color = (
Expand Down
1 change: 1 addition & 0 deletions jaclang/tests/fixtures/builtin_dotgen.jac
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ with entry{
print(d2.count('a(val')==19,d2.count('#F5E5FF')==2 ,'Edge1' not in d2,d2.count('GenericEdge')==42);
print(d3.count('a(val')==6,d3.count("GenericEdge")==5,d3.count('#F5E5FF')==1);
print(d4.count("a(val")==25,d4.count("GenericEdge")==66,d4.count('#FFF0F')==3);
print(d5.count("Edge1(val=6)")==2, d5.count("GenericEdge()")==24);
# print(l3<l2);
# print(d1);
# print(d2);
Expand Down
2 changes: 1 addition & 1 deletion jaclang/tests/test_language.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def test_gen_dot_builtin(self) -> None:
jac_import("builtin_dotgen", base_path=self.fixture_abs_path("./"))
sys.stdout = sys.__stdout__
stdout_value = captured_output.getvalue()
self.assertEqual(stdout_value.count("True"), 14)
self.assertEqual(stdout_value.count("True"), 16)

def test_with_contexts(self) -> None:
"""Test walking through edges."""
Expand Down

0 comments on commit 13a4dda

Please sign in to comment.