Skip to content

Commit

Permalink
update test case to fit FLANN & max_dist exception
Browse files Browse the repository at this point in the history
  • Loading branch information
naspert committed Mar 19, 2018
1 parent ae83814 commit 62fc0ce
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions pygsp/tests/test_graphs.py
Expand Up @@ -182,24 +182,16 @@ def test_set_coordinates(self):
def test_nngraph(self):
Xin = np.arange(90).reshape(30, 3)
dist_types = ['euclidean', 'manhattan', 'max_dist', 'minkowski']
backends = ['scipy-kdtree', 'scipy-pdist', 'flann']
order=3 # for minkowski
backends = ['scipy-kdtree', 'scipy-pdist', 'flann']
order=3 # for minkowski, FLANN only accepts integer orders

for cur_backend in backends:
for dist_type in dist_types:
print("backend={} dist={}".format(cur_backend, dist_type))
if dist_type != 'minkowski':
# curently radius only implemented with scipy kdtree
if cur_backend == 'scipy-kdtree':
graphs.NNGraph(Xin, NNtype='radius',
backend=cur_backend,
dist_type=dist_type)
graphs.NNGraph(Xin, NNtype='knn',
backend=cur_backend,
dist_type=dist_type)
if cur_backend == 'flann' and dist_type == 'max_dist':
self.assertRaises(ValueError, graphs.NNGraph, Xin,
NNtype='knn', backend=cur_backend,
dist_type=dist_type)
else:
# Only p-norms with 1<=p<=infinity permitted.
# flann only accepts integer orders
if cur_backend == 'scipy-kdtree':
graphs.NNGraph(Xin, NNtype='radius',
backend=cur_backend,
Expand All @@ -208,7 +200,6 @@ def test_nngraph(self):
backend=cur_backend,
dist_type=dist_type, order=order)


def test_bunny(self):
graphs.Bunny()

Expand Down

0 comments on commit 62fc0ce

Please sign in to comment.