Skip to content

Commit

Permalink
explicit testing for undirected and directed edges in value view for …
Browse files Browse the repository at this point in the history
…adjacency graph
  • Loading branch information
eileen-kuehn committed Jul 26, 2018
1 parent 20a1f08 commit 8cf8142
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions graphi_unittests/types_unittests/test_adjacency_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,3 +280,20 @@ def test_edge_view_directed(self):
[1, 2, 3] in edge_view
with self.assertRaises(TypeError):
None in edge_view

def test_value_view_undirected(self):
graph = self.graph_cls({1, 2, 3, 4}, undirected=True)
nodes = [2, 3, 4]
for value, node in enumerate(nodes):
graph[1:node] = value
value_view = graph.values()
self.assertEqual(len(nodes), len(value_view), "The number of values should be half for undirected graphs")

def test_value_view_directed(self):
graph = self.graph_cls({1, 2, 3, 4}, undirected=False)
nodes = [2, 3, 4]
for value, node in enumerate(nodes):
graph[1:node] = value
graph[node:1] = 4
value_view = graph.values()
self.assertEqual(len(nodes) * 2, len(value_view))

0 comments on commit 8cf8142

Please sign in to comment.