From 3d3179ac21c36934be3e3ee4bf68fff22211e100 Mon Sep 17 00:00:00 2001 From: "Navid C. Constantinou" Date: Tue, 5 Sep 2023 16:04:40 +1000 Subject: [PATCH] remove random unit vector; add 2 more tests --- tests/test_grid_generation.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/test_grid_generation.py b/tests/test_grid_generation.py index 4c50148e..405d2c27 100644 --- a/tests/test_grid_generation.py +++ b/tests/test_grid_generation.py @@ -6,19 +6,13 @@ import xarray as xr -def random_unit_vector(): - """Return a random unit vector on the unit sphere.""" - z = 2 * np.random.rand(1)[0] - 1 - z - θ = 2 * np.pi * np.random.rand(1)[0] - return [np.sqrt(1 - z**2) * np.cos(θ), np.sqrt(1 - z**2) * np.sin(θ), z] - - @pytest.mark.parametrize( ("v1", "v2", "v3", "true_angle"), [ ([1, 0, 0], [0, 1, 0], [0, 0, 1], np.pi / 2), ([1, 0, 0], [1, 1, 0], [0, 1, 1], np.pi / 4), + ([1, 0, 0], [1, 1, 1], [0, 0, 1], np.pi / 4), + ([1, 1, 1], [1, 1, 0], [0, 1, 1], 2 * np.pi / 3) ], ) def test_angle_between(v1, v2, v3, true_angle):