Skip to content

Commit 838550e

Browse files
committed
last stuff
1 parent 96f8b96 commit 838550e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

test/test_utils.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def f(i):
2222

2323
l2 = list(ot.utils.parmap(f, a))
2424

25-
assert np.allclose(l1, l2)
25+
np.testing.assert_allclose(l1, l2)
2626

2727

2828
def test_tic_toc():
@@ -35,10 +35,10 @@ def test_tic_toc():
3535
t2 = ot.toq()
3636

3737
# test timing
38-
assert np.allclose(0.5, t, rtol=1e-2, atol=1e-2)
38+
np.testing.assert_allclose(0.5, t, rtol=1e-2, atol=1e-2)
3939

4040
# test toc vs toq
41-
assert np.allclose(t, t2, rtol=1e-2, atol=1e-2)
41+
np.testing.assert_allclose(t, t2, rtol=1e-2, atol=1e-2)
4242

4343

4444
def test_kernel():
@@ -50,7 +50,7 @@ def test_kernel():
5050
K = ot.utils.kernel(x, x)
5151

5252
# gaussian kernel has ones on the diagonal
53-
assert np.allclose(np.diag(K), np.ones(n))
53+
np.testing.assert_allclose(np.diag(K), np.ones(n))
5454

5555

5656
def test_unif():
@@ -59,7 +59,7 @@ def test_unif():
5959

6060
u = ot.unif(n)
6161

62-
assert np.allclose(1, np.sum(u))
62+
np.testing.assert_allclose(1, np.sum(u))
6363

6464

6565
def test_dist():
@@ -77,8 +77,8 @@ def test_dist():
7777
D3 = ot.dist(x)
7878

7979
# dist shoul return squared euclidean
80-
assert np.allclose(D, D2)
81-
assert np.allclose(D, D3)
80+
np.testing.assert_allclose(D, D2)
81+
np.testing.assert_allclose(D, D3)
8282

8383

8484
def test_dist0():
@@ -87,7 +87,7 @@ def test_dist0():
8787
M = ot.utils.dist0(n, method='lin_square')
8888

8989
# dist0 default to linear sampling with quadratic loss
90-
assert np.allclose(M[0, -1], (n - 1) * (n - 1))
90+
np.testing.assert_allclose(M[0, -1], (n - 1) * (n - 1))
9191

9292

9393
def test_dots():
@@ -102,7 +102,7 @@ def test_dots():
102102

103103
X2 = A.dot(B.dot(C))
104104

105-
assert np.allclose(X1, X2)
105+
np.testing.assert_allclose(X1, X2)
106106

107107

108108
def test_clean_zeros():

0 commit comments

Comments
 (0)