From b0af7bfb40a088f328e91671e599a2cbbd5f1234 Mon Sep 17 00:00:00 2001 From: Kaushik Kulkarni <kaushikcfd@gmail.com> Date: Mon, 28 Jun 2021 13:52:23 -0500 Subject: [PATCH] take to_numpy before comparing actx's scalars --- test/test_arraycontext.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/test/test_arraycontext.py b/test/test_arraycontext.py index 9f194ab..5425dd4 100644 --- a/test/test_arraycontext.py +++ b/test/test_arraycontext.py @@ -257,7 +257,7 @@ def test_actx_stack(actx_factory): ndofs = 5000 args = [np.random.randn(ndofs) for i in range(10)] - assert_close_to_numpy( + assert_close_to_numpy_in_containers( actx, lambda _np, *_args: _np.stack(_args), args) @@ -656,9 +656,8 @@ def test_container_arithmetic(actx_factory): bcast_result = ary_dof + bcast_dc_of_dofs bcast_dc_of_dofs + ary_dof - res = bcast_result.mass - 2*ary_of_dofs - - assert np.linalg.norm(actx.to_numpy(res[0][0]) < 1e-8) + assert actx.to_numpy(actx.np.linalg.norm(bcast_result.mass + - 2*ary_of_dofs)) < 1e-8 mock_gradient = MyContainerDOFBcast( name="yo", @@ -670,9 +669,8 @@ def test_container_arithmetic(actx_factory): assert isinstance(grad_matvec_result.mass, DOFArray) assert grad_matvec_result.momentum.shape == (3,) - res = grad_matvec_result.mass - 3*ary_of_dofs**2 - - assert np.linalg.norm(actx.to_numpy(res[0][0]) < 1e-8) + assert actx.to_numpy(actx.np.linalg.norm(grad_matvec_result.mass + - 3*ary_of_dofs**2)) < 1e-8 # }}} -- GitLab