Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgigante committed Oct 12, 2019
1 parent 786179f commit 5865f1a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
8 changes: 8 additions & 0 deletions test/test_knn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
####################
Expand Down
10 changes: 10 additions & 0 deletions test/test_mnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 5865f1a

Please sign in to comment.