Skip to content

Commit 5865f1a

Browse files
committed
add tests
1 parent 786179f commit 5865f1a

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

test/test_data.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ def test_badstring_rank_threshold():
6565
build_graph(data, n_pca=True, rank_threshold='foobar')
6666

6767

68+
@raises(ValueError)
69+
def test_negative_rank_threshold():
70+
build_graph(data, n_pca=True, rank_threshold=-1)
71+
72+
6873
@raises(ValueError)
6974
@warns(RuntimeWarning)
7075
def test_True_n_pca_large_threshold():

test/test_knn.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,14 @@ def test_shortest_path_precomputed_no_decay_data():
380380
G.shortest_path(distance='data')
381381

382382

383+
@raises(ValueError)
384+
def test_shortest_path_invalid():
385+
data_small = data[np.random.choice(
386+
len(data), len(data) // 4, replace=False)]
387+
G = build_graph(data_small, knn=5, decay=None)
388+
G.shortest_path(distance='invalid')
389+
390+
383391
####################
384392
# Test API
385393
####################

test/test_mnn.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@ def test_mnn_with_kernel_symm_gamma():
116116
theta=0.9)
117117

118118

119+
@raises(ValueError)
120+
def test_mnn_with_kernel_symm_invalid():
121+
build_graph(
122+
data, thresh=0, n_pca=20,
123+
decay=10, knn=5, random_state=42,
124+
sample_idx=digits['target'],
125+
kernel_symm='invalid',
126+
theta=0.9)
127+
128+
119129
@warns(FutureWarning)
120130
def test_mnn_with_kernel_symm_theta():
121131
build_graph(

0 commit comments

Comments
 (0)