From 4fd4e5349e5bae1b9e1b1a9397c4f9c454b1aee5 Mon Sep 17 00:00:00 2001 From: pbrod Date: Mon, 30 Nov 2015 00:11:46 +0100 Subject: [PATCH] Changed doctest for normndprb into a unittest --- wafo/tests/test_gaussian.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/wafo/tests/test_gaussian.py b/wafo/tests/test_gaussian.py index d3faef8..76598bc 100644 --- a/wafo/tests/test_gaussian.py +++ b/wafo/tests/test_gaussian.py @@ -67,7 +67,7 @@ def test_rind(): assert_array_almost_equal(err3, 0.00013838) assert_array_almost_equal(terr3, 1.00000000e-10) - E4, err4, terr4 = rind2(Sc2,m2,Blo2,Bup2,indI2,nt=0) + E4, err4, terr4 = rind2(Sc2, m2, Blo2, Bup2, indI2, nt=0) assert_array_almost_equal(E4, 0.24127499) assert_array_almost_equal(err4, 0.00013838) assert_array_almost_equal(terr4, 1.00000000e-10) @@ -123,21 +123,21 @@ def test_prbnormndpc(): def test_prbnormnd(): - ''' - >>> import numpy as np - >>> Et = 0.001946 # # exact prob. - >>> n = 5 - >>> Blo =-np.inf; Bup=-1.2 - >>> m = np.zeros(n); rho = 0.3; - >>> Sc =(np.ones((n,n))-np.eye(n))*rho+np.eye(n) - >>> A = np.repeat(Blo,n) - >>> B = np.repeat(Bup,n)-m - >>> [val,err,inform] = prbnormnd(Sc,A,B) - >>> np.abs(val-Et)< err - True - >>> 'val = %2.5f' % val - 'val = 0.00195' - ''' + + Et = 0.001946 # exact prob. + n = 5 + Blo = -np.inf + Bup = -1.2 + m = np.zeros(n) + rho = 0.3 + Sc = (np.ones((n, n)) - np.eye(n)) * rho + np.eye(n) + A = np.repeat(Blo, n) + B = np.repeat(Bup, n) - m + [val, err, _inform] = prbnormnd(Sc, A, B) + assert(np.abs(val - Et) < err) + + t = 'val = %2.5f' % val + assert(t == 'val = 0.00195') def test_cdfnorm2d():