def test_vector_dahlquist_set_values(): """ Test the set_values() """ vector_dahlquist = VectorDahlquist(1) vector_dahlquist.set_values(3) np.testing.assert_equal(vector_dahlquist.value, 3)
def test_vector_dahlquist_sub(): """ Test __sub__ """ vector_dahlquist_1 = VectorDahlquist(1) vector_dahlquist_2 = VectorDahlquist(2) vector_dahlquist_res = vector_dahlquist_2 - vector_dahlquist_1 np.testing.assert_equal(vector_dahlquist_res.value, 1)
def test_vector_dahlquist_add(): """ Test __add__ """ vector_dahlquist_1 = VectorDahlquist(1) vector_dahlquist_2 = VectorDahlquist(2) vector_dahlquist_res = vector_dahlquist_1 + vector_dahlquist_2 np.testing.assert_equal(vector_dahlquist_res.value, 3)
def test_vector_dahlquist_clone_rand(): """ Test clone_rand() """ vector_dahlquist = VectorDahlquist(1) vector_dahlquist_clone = vector_dahlquist.clone_rand() np.testing.assert_equal( True, isinstance(vector_dahlquist_clone, VectorDahlquist))
def test_dahlquist_step_fe(): """ Test step() """ dahlquist = Dahlquist(method='FE', t_start=0, t_stop=1, nt=11) dahlquist_res = dahlquist.step(u_start=VectorDahlquist(1), t_start=0, t_stop=0.1) np.testing.assert_almost_equal(dahlquist_res.get_values(), 0.9)
def test_vector_dahlquist_mul(): """ Test __sub__ """ vector_dahlquist_1 = VectorDahlquist(1) vector_dahlquist_res = vector_dahlquist_1 * 7 np.testing.assert_equal(vector_dahlquist_res.value, 7) vector_dahlquist_res = 8 * vector_dahlquist_1 np.testing.assert_equal(vector_dahlquist_res.value, 8) vector_dahlquist_res *= 7 np.testing.assert_equal(vector_dahlquist_res.value, 56)
def test_vector_dahlquist_get_values(): """ Test get_values() """ vector_dahlquist = VectorDahlquist(5) np.testing.assert_equal(vector_dahlquist.get_values(), 5)
def test_vector_dahlquist_norm(): """ Test norm() """ vector_dahlquist = VectorDahlquist(1) np.testing.assert_equal(np.linalg.norm(1), vector_dahlquist.norm())
def test_vector_dahlquist_constructor(): """ Test constructor """ vector_dahlquist = VectorDahlquist(1) np.testing.assert_equal(vector_dahlquist.value, 1)