Skip to content

Commit 62fc0ce

Browse files
committed
update test case to fit FLANN & max_dist exception
1 parent ae83814 commit 62fc0ce

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

pygsp/tests/test_graphs.py

+6-15
Original file line numberDiff line numberDiff line change
@@ -182,24 +182,16 @@ def test_set_coordinates(self):
182182
def test_nngraph(self):
183183
Xin = np.arange(90).reshape(30, 3)
184184
dist_types = ['euclidean', 'manhattan', 'max_dist', 'minkowski']
185-
backends = ['scipy-kdtree', 'scipy-pdist', 'flann']
186-
order=3 # for minkowski
185+
backends = ['scipy-kdtree', 'scipy-pdist', 'flann']
186+
order=3 # for minkowski, FLANN only accepts integer orders
187187

188188
for cur_backend in backends:
189189
for dist_type in dist_types:
190-
print("backend={} dist={}".format(cur_backend, dist_type))
191-
if dist_type != 'minkowski':
192-
# curently radius only implemented with scipy kdtree
193-
if cur_backend == 'scipy-kdtree':
194-
graphs.NNGraph(Xin, NNtype='radius',
195-
backend=cur_backend,
196-
dist_type=dist_type)
197-
graphs.NNGraph(Xin, NNtype='knn',
198-
backend=cur_backend,
199-
dist_type=dist_type)
190+
if cur_backend == 'flann' and dist_type == 'max_dist':
191+
self.assertRaises(ValueError, graphs.NNGraph, Xin,
192+
NNtype='knn', backend=cur_backend,
193+
dist_type=dist_type)
200194
else:
201-
# Only p-norms with 1<=p<=infinity permitted.
202-
# flann only accepts integer orders
203195
if cur_backend == 'scipy-kdtree':
204196
graphs.NNGraph(Xin, NNtype='radius',
205197
backend=cur_backend,
@@ -208,7 +200,6 @@ def test_nngraph(self):
208200
backend=cur_backend,
209201
dist_type=dist_type, order=order)
210202

211-
212203
def test_bunny(self):
213204
graphs.Bunny()
214205

0 commit comments

Comments
 (0)