diff --git a/test/test_data.py b/test/test_data.py index 3095475..f809478 100644 --- a/test/test_data.py +++ b/test/test_data.py @@ -65,6 +65,11 @@ def test_badstring_rank_threshold(): build_graph(data, n_pca=True, rank_threshold='foobar') +@raises(ValueError) +def test_negative_rank_threshold(): + build_graph(data, n_pca=True, rank_threshold=-1) + + @raises(ValueError) @warns(RuntimeWarning) def test_True_n_pca_large_threshold(): diff --git a/test/test_knn.py b/test/test_knn.py index a78a3dc..52e0223 100644 --- a/test/test_knn.py +++ b/test/test_knn.py @@ -380,6 +380,14 @@ def test_shortest_path_precomputed_no_decay_data(): G.shortest_path(distance='data') +@raises(ValueError) +def test_shortest_path_invalid(): + data_small = data[np.random.choice( + len(data), len(data) // 4, replace=False)] + G = build_graph(data_small, knn=5, decay=None) + G.shortest_path(distance='invalid') + + #################### # Test API #################### diff --git a/test/test_mnn.py b/test/test_mnn.py index 2dd6465..0e91aa4 100644 --- a/test/test_mnn.py +++ b/test/test_mnn.py @@ -116,6 +116,16 @@ def test_mnn_with_kernel_symm_gamma(): theta=0.9) +@raises(ValueError) +def test_mnn_with_kernel_symm_invalid(): + build_graph( + data, thresh=0, n_pca=20, + decay=10, knn=5, random_state=42, + sample_idx=digits['target'], + kernel_symm='invalid', + theta=0.9) + + @warns(FutureWarning) def test_mnn_with_kernel_symm_theta(): build_graph(