diff --git a/tests/integration/test_models/standard_output_tests.py b/tests/integration/test_models/standard_output_tests.py index b95fe513d5..b4f5c0cef9 100644 --- a/tests/integration/test_models/standard_output_tests.py +++ b/tests/integration/test_models/standard_output_tests.py @@ -285,23 +285,37 @@ def test_concentration_increase_decrease(self): # For the assumed polynomial concentration profiles the values # can increase/decrease within the particle as the polynomial shifts, # so we just check the average instead - neg_end_vs_start = self.c_s_n_rav(t[1:], x_n) - self.c_s_n_rav(t[:-1], x_n) - pos_end_vs_start = self.c_s_p_rav(t[1:], x_p) - self.c_s_p_rav(t[:-1], x_p) + neg_diff = self.c_s_n_rav(t[1:], x_n) - self.c_s_n_rav(t[:-1], x_n) + pos_diff = self.c_s_p_rav(t[1:], x_p) - self.c_s_p_rav(t[:-1], x_p) + neg_end_vs_start = self.c_s_n_rav(t[-1], x_n) - self.c_s_n_rav(t[0], x_n) + pos_end_vs_start = self.c_s_p_rav(t[-1], x_p) - self.c_s_p_rav(t[0], x_p) else: - neg_end_vs_start = self.c_s_n(t[1:], x_n, r_n) - self.c_s_n( + neg_diff = self.c_s_n(t[1:], x_n, r_n) - self.c_s_n( t[:-1], x_n, r_n ) - pos_end_vs_start = self.c_s_p(t[1:], x_p, r_p) - self.c_s_p( + pos_diff = self.c_s_p(t[1:], x_p, r_p) - self.c_s_p( t[:-1], x_p, r_p ) + neg_end_vs_start = self.c_s_n(t[-1], x_n, r_n) - self.c_s_n( + t[0], x_n, r_n + ) + pos_end_vs_start = self.c_s_p(t[-1], x_p, r_p) - self.c_s_p( + t[0], x_p, r_p + ) if self.operating_condition == "discharge": - np.testing.assert_array_less(neg_end_vs_start, 1e-16) - np.testing.assert_array_less(-1e-16, pos_end_vs_start) + np.testing.assert_array_less(neg_diff, 1e-16) + np.testing.assert_array_less(-1e-16, pos_diff) + np.testing.assert_array_less(neg_end_vs_start, 0) + np.testing.assert_array_less(0, pos_end_vs_start) elif self.operating_condition == "charge": - np.testing.assert_array_less(-1e-16, neg_end_vs_start) - np.testing.assert_array_less(pos_end_vs_start, 1e-16) + np.testing.assert_array_less(-1e-16, neg_diff) + np.testing.assert_array_less(pos_diff, 1e-16) + np.testing.assert_array_less(0, neg_end_vs_start) + np.testing.assert_array_less(pos_end_vs_start, 0) elif self.operating_condition == "off": + np.testing.assert_array_almost_equal(neg_diff, 0) + np.testing.assert_array_almost_equal(pos_diff, 0) np.testing.assert_array_almost_equal(neg_end_vs_start, 0) np.testing.assert_array_almost_equal(pos_end_vs_start, 0) @@ -374,8 +388,8 @@ def test_fluxes(self): ) np.testing.assert_array_less(self.N_s_p(t[1:], x_p, r_p[1:]), 1e-16) if self.operating_condition == "charge": - np.testing.assert_equal(self.N_s_n(t[1:], x_n, r_n[1:]), 1e-16) - np.testing.assert_equal(-1e-16, self.N_s_p(t[1:], x_p, r_p[1:])) + np.testing.assert_array_less(self.N_s_n(t[1:], x_n, r_n[1:]), 1e-16) + np.testing.assert_array less(-1e-16, self.N_s_p(t[1:], x_p, r_p[1:])) if self.operating_condition == "off": np.testing.assert_array_almost_equal(self.N_s_n(t, x_n, r_n), 0) np.testing.assert_array_almost_equal(self.N_s_p(t, x_p, r_p), 0)