Skip to content

Commit

Permalink
Added additional Graph selection test
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Oct 2, 2017
1 parent dc508f4 commit 8775217
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/testgraphelement.py
Expand Up @@ -40,8 +40,9 @@ def test_constructor_with_nodes_and_paths_dimension_mismatch(self):

def test_select_by_node(self):
graph = Graph(((self.source, self.target),))
selection = Graph(([(0,0), (1, 0)], list(zip(*self.nodes))[:2]))
self.assertEqual(graph.select(index=(0, 2)), selection)
selection = Graph(([(1, 0), (2, 0)], list(zip(*self.nodes))[0:3]))
print(graph.select(index=(1, 3)).data)
self.assertEqual(graph.select(index=(1, 3)), selection)

def test_select_by_source(self):
graph = Graph(((self.source, self.target),))
Expand All @@ -53,6 +54,11 @@ def test_select_by_target(self):
selection = Graph(([(0,0), (1, 0)], list(zip(*self.nodes))[:2]))
self.assertEqual(graph.select(start=(0, 2)), selection)

def test_select_by_source_and_target(self):
graph = Graph(((self.source, self.source+1), self.nodes))
selection = Graph(([(0,1)], list(zip(*self.nodes))[:2]))
self.assertEqual(graph.select(start=(0, 3), end=1), selection)

def test_select_by_edge_data(self):
graph = Graph(((self.target, self.source, self.edge_info),), vdims=['info'])
selection = Graph(([(0, 0, 0), (0, 1, 1)], list(zip(*self.nodes))[:2]), vdims=['info'])
Expand Down

0 comments on commit 8775217

Please sign in to comment.