Commit eda41eeb authored by Matevz, Sraml (sraml)'s avatar Matevz, Sraml (sraml)

updated tests

parent 613e2efb
Pipeline #14112 failed with stage
in 5 minutes and 46 seconds
......@@ -164,6 +164,7 @@ class DescentMinimizer(Loggable, object):
new_energy = energy.at( position=energy.position +
np.random.rand()/10*(new_energy.position-energy.position) )
energy = new_energy
convergence = self.convergence_level + 2
break
energy = new_energy
......
import unittest
from numpy.testing import assert_approx_equal, assert_equal
from numpy.testing import assert_equal, assert_almost_equal
from nifty import *
......@@ -31,7 +31,7 @@ class ConjugateGradient_Tests(unittest.TestCase):
if position.domain[0] != space:
raise TypeError
if type(convergence) != float:
if type(convergence) != int:
raise TypeError
@expand(product(spaces, [10, 100, 1000], [1E-3, 1E-4, 1E-5], [2, 3, 4] ))
......@@ -49,7 +49,7 @@ class ConjugateGradient_Tests(unittest.TestCase):
(position, convergence) = minimizer(A=A, x0=x0, b=b)
assert_approx_equal(position.val.get_full_data(),
assert_almost_equal(position.val.get_full_data(),
test_x.val.get_full_data(), significant=3)
assert_equal(convergence, convergence_level+1)
......
import unittest
from numpy.testing import assert_approx_equal, assert_equal
from numpy.testing import assert_equal, assert_almost_equal
from nifty import *
......@@ -58,7 +58,7 @@ class RelaxedNewton_Tests(unittest.TestCase):
if energy.position.domain[0] != space:
raise TypeError
if type(convergence) != float:
if type(convergence) != int:
raise TypeError
@expand(product(spaces, [10, 100, 1000], [1E-3, 1E-4, 1E-5], [2, 3, 4] ))
......@@ -76,8 +76,8 @@ class RelaxedNewton_Tests(unittest.TestCase):
(energy, convergence) = minimizer(energy)
assert_approx_equal(energy.value, 0, significant=3)
assert_approx_equal(energy.position.val.get_full_data(),
assert_almost_equal(energy.value, 0, significant=3)
assert_almost_equal(energy.position.val.get_full_data(),
test_x.val.get_full_data(), significant=3)
assert_equal(convergence, convergence_level+2)
......
import unittest
from numpy.testing import assert_approx_equal, assert_equal
from numpy.testing import assert_equal, assert_almost_equal
from nifty import *
......@@ -58,7 +58,7 @@ class SteepestDescent_Tests(unittest.TestCase):
if energy.position.domain[0] != space:
raise TypeError
if type(convergence) != float:
if type(convergence) != int:
raise TypeError
@expand(product(spaces, [10, 100, 1000], [1E-3, 1E-4, 1E-5], [2, 3, 4] ))
......@@ -76,7 +76,7 @@ class SteepestDescent_Tests(unittest.TestCase):
(energy, convergence) = minimizer(energy)
assert_approx_equal(energy.value, 0, significant=3)
assert_approx_equal(energy.position.val.get_full_data(),
assert_almost_equal(energy.value, 0, significant=3)
assert_almost_equal(energy.position.val.get_full_data(),
test_x.val.get_full_data(), significant=3)
assert_equal(convergence, convergence_level+2)
import unittest
from numpy.testing import assert_approx_equal, assert_equal
from numpy.testing import assert_equal, assert_almost_equal
from nifty import *
......@@ -57,7 +57,7 @@ class VL_BFGS_Tests(unittest.TestCase):
if energy.position.domain[0] != space:
raise TypeError
if type(convergence) != float:
if type(convergence) != int:
raise TypeError
@expand(product(spaces, [10, 100, 1000], [1E-3, 1E-4, 1E-5], [2, 3, 4] ))
......@@ -75,8 +75,8 @@ class VL_BFGS_Tests(unittest.TestCase):
(energy, convergence) = minimizer(energy)
assert_approx_equal(energy.value, 0, significant=3)
assert_approx_equal(energy.position.val.get_full_data(),
assert_almost_equal(energy.value, 0, significant=3)
assert_almost_equal(energy.position.val.get_full_data(),
test_x.val.get_full_data(), significant=3)
assert_equal(convergence, convergence_level)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment