diff --git a/environment.yml b/environment.yml index 6fcf810..e8087c0 100644 --- a/environment.yml +++ b/environment.yml @@ -2,6 +2,6 @@ name: polyhedral-gravity-env channels: - conda-forge dependencies: - - numpy==1.23.4 + - numpy - pytest - pytest-xdist \ No newline at end of file diff --git a/test/python/test_polyhedral_gravity.py b/test/python/test_polyhedral_gravity.py index 6f9fa8d..d7814bf 100644 --- a/test/python/test_polyhedral_gravity.py +++ b/test/python/test_polyhedral_gravity.py @@ -65,12 +65,10 @@ def test_polyhedral_gravity( computation_points=points, parallel=True ) - sol = np.array([np.array(x) for x in sol]) - actual_potential = sol[:, 0].flatten() - assert np.testing.assert_array_almost_equal(actual_potential, expected_potential) is None - - actual_acceleration = np.array([np.array(x) for x in sol[:, 1]]) - assert np.testing.assert_array_almost_equal(actual_acceleration, expected_acceleration) is None + potential = np.array([result[0] for result in sol]) + acceleration = np.array([result[1] for result in sol]) + np.testing.assert_array_almost_equal(potential, expected_potential) + np.testing.assert_array_almost_equal(acceleration, expected_acceleration) @pytest.mark.parametrize( @@ -92,12 +90,10 @@ def test_polyhedral_gravity_evaluable( computation_points=points, parallel=True ) - sol = np.array([np.array(x) for x in sol]) - actual_potential = sol[:, 0].flatten() - assert np.testing.assert_array_almost_equal(actual_potential, expected_potential) is None - - actual_acceleration = np.array([np.array(x) for x in sol[:, 1]]) - assert np.testing.assert_array_almost_equal(actual_acceleration, expected_acceleration) is None + potential = np.array([result[0] for result in sol]) + acceleration = np.array([result[1] for result in sol]) + np.testing.assert_array_almost_equal(potential, expected_potential) + np.testing.assert_array_almost_equal(acceleration, expected_acceleration) @pytest.mark.parametrize( @@ -128,9 +124,7 @@ def test_polyhedral_evaluable_pickle( computation_points=points, parallel=True ) - sol = np.array([np.array(x) for x in sol]) - actual_potential = sol[:, 0].flatten() - assert np.testing.assert_array_almost_equal(actual_potential, expected_potential) is None - - actual_acceleration = np.array([np.array(x) for x in sol[:, 1]]) - assert np.testing.assert_array_almost_equal(actual_acceleration, expected_acceleration) is None + potential = np.array([result[0] for result in sol]) + acceleration = np.array([result[1] for result in sol]) + np.testing.assert_array_almost_equal(potential, expected_potential) + np.testing.assert_array_almost_equal(acceleration, expected_acceleration)