Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Laasri committed Dec 8, 2018
2 parents 157412e + f45fbab commit 4961fdb
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,21 @@ def test_func5(x):
assert (np.isclose(optimize.newtons_method(test_func5, [5, 4, 5], method="gmres_action", max_iter=1000)[0],
[-0.5, 2.1038034, 0.33333333]))[0]

def test_func6(x):
x1 = x[0]
return np.array([(x1 ** 2) + 3])

with pytest.raises(RuntimeError):
optimize.newtons_method(test_func6, [5], method="gmres", max_iter= 1000)

with pytest.raises(RuntimeError):
optimize.newtons_method(test_func6, [5], method="gmres_action", max_iter=1000)

with pytest.raises(Exception):
optimize.newtons_method(test_func6, [5,5,5], method="gmres", max_iter= 1000)

with pytest.raises(Exception):
optimize.newtons_method(test_func6, [5,5,5], method="gkkk", max_iter= 1000)

with pytest.raises(Exception):
optimize.quasi_newtons_method(rosenbrock, [2, 3], method='gfdgh')

0 comments on commit 4961fdb

Please sign in to comment.