Skip to content

Commit 1a720e6

Browse files
committed
graph default edge attributes test
1 parent c50efad commit 1a720e6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/compas/datastructures/test_graph.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ def test_default_node_attributes():
5757
for node in graph.nodes():
5858
assert graph.node_attribute(node, name='a') == 1
5959
assert graph.node_attribute(node, name='b') == 2
60+
graph.node_attribute(node, name='a', value=3)
61+
assert graph.node_attribute(node, name='a') == 3
62+
63+
64+
def test_default_edge_attributes():
65+
graph = Graph(name='test', default_edge_attributes={'a': 1, 'b': 2})
66+
for edge in graph.edges():
67+
assert graph.edge_attribute(edge, name='a') == 1
68+
assert graph.edge_attribute(edge, name='b') == 2
69+
graph.edge_attribute(edge, name='a', value=3)
70+
assert graph.edge_attribute(edge, name='a') == 3
6071

6172

6273
def test_graph_networkx_conversion():

0 commit comments

Comments
 (0)