File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44import numpy as np
55from numpy .random import rand
6- from pytest import raises
6+ from pytest import raises , warns
77
88from nigsp .operations import metrics
99from nigsp .utils import prepare_ndim_iteration
@@ -73,13 +73,22 @@ def test_gsdi():
7373
7474
7575def test_smoothness ():
76- signal = rand (10 , 2 )
76+ s1 = rand (10 )
77+ s2 = rand (10 , 2 )
78+ s3 = rand (2 , 10 )
7779 laplacian = rand (10 , 10 )
7880
79- expected_smoothness = np .dot (signal .T , np .dot (laplacian , signal ))
80- computed_smoothness = metrics .smoothness (laplacian , signal )
81+ expected_smoothness1 = np .dot (s1 .T , np .dot (laplacian , s1 ))
82+ expected_smoothness2 = np .dot (s2 .T , np .dot (laplacian , s2 ))
83+ expected_smoothness3 = np .dot (s3 , np .dot (laplacian , s3 .T ))
84+
85+ computed_smoothness1 = metrics .smoothness (laplacian , s1 )
86+ computed_smoothness2 = metrics .smoothness (laplacian , s2 )
87+ computed_smoothness3 = metrics .smoothness (laplacian , s3 )
8188
82- assert (expected_smoothness == computed_smoothness ).all ()
89+ assert (expected_smoothness1 == computed_smoothness1 ).all ()
90+ assert (expected_smoothness2 == computed_smoothness2 ).all ()
91+ assert (expected_smoothness3 == computed_smoothness3 ).all ()
8392
8493
8594# ### Break tests
You can’t perform that action at this time.
0 commit comments