Skip to content

Commit

Permalink
Add more tests for Sphere class
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkWieczorek committed Apr 11, 2024
1 parent e347a4f commit 2e1c831
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions boule/tests/test_sphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,23 @@ def test_check_geocentric_grav_const():
assert len(warn) >= 1


def test_normal_gravity_computed_on_internal_point(sphere):
"""
Check if warn is raised if height is negative for normal_gravity,
normal_gravity_potential, and normal_gravitational_potential.
"""
latitude = np.linspace(-90, 90, 100)
with warnings.catch_warnings(record=True) as warn:
sphere.normal_gravity(latitude, height=-10)
assert len(warn) >= 1
with warnings.catch_warnings(record=True) as warn:
sphere.normal_gravity_potential(latitude, height=-10)
assert len(warn) >= 1
with warnings.catch_warnings(record=True) as warn:
sphere.normal_gravitational_potential(latitude, height=-10)
assert len(warn) >= 1


@pytest.mark.parametrize("si_units", [False, True], ids=["mGal", "SI"])
def test_normal_gravity_pole_equator(sphere, si_units):
"""
Expand Down

0 comments on commit 2e1c831

Please sign in to comment.