From af9bd944d0cfe05b4157db36c1c8aae00ac03682 Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Mon, 1 Nov 2021 12:50:20 +0100 Subject: [PATCH] ease test tolerance on timeseries --- control/tests/flatsys_test.py | 5 +++-- control/tests/timeresp_test.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/control/tests/flatsys_test.py b/control/tests/flatsys_test.py index 373af8dae..6f4ef7cef 100644 --- a/control/tests/flatsys_test.py +++ b/control/tests/flatsys_test.py @@ -339,8 +339,9 @@ def test_point_to_point_errors(self): traj_kwarg = fs.point_to_point( flat_sys, timepts, x0, u0, xf, uf, cost=cost_fcn, basis=fs.PolyFamily(8), minimize_kwargs={'method': 'slsqp'}) - np.testing.assert_almost_equal( - traj_method.eval(timepts)[0], traj_kwarg.eval(timepts)[0]) + np.testing.assert_allclose( + traj_method.eval(timepts)[0], traj_kwarg.eval(timepts)[0], + atol=1e-5) # Unrecognized keywords with pytest.raises(TypeError, match="unrecognized keyword"): diff --git a/control/tests/timeresp_test.py b/control/tests/timeresp_test.py index c74c0c06d..d9cb065f6 100644 --- a/control/tests/timeresp_test.py +++ b/control/tests/timeresp_test.py @@ -681,7 +681,8 @@ def test_forced_response_T_U(self, tsystem, fr_kwargs, refattr): fr_kwargs['X0'] = tsystem.X0 t, y = forced_response(tsystem.sys, **fr_kwargs) np.testing.assert_allclose(t, tsystem.t) - np.testing.assert_allclose(y, getattr(tsystem, refattr), rtol=1e-3) + np.testing.assert_allclose(y, getattr(tsystem, refattr), + rtol=1e-3, atol=1e-5) @pytest.mark.parametrize("tsystem", ["siso_ss1"], indirect=True) def test_forced_response_invalid_c(self, tsystem):