def test_compute_missing_body_hill_radius_raises_error(missing_body): with pytest.raises(RuntimeError) as excinfo: hill_radius(missing_body) assert ( "To compute the semimajor axis or eccentricity for Moon and Pluto use the JPL ephemeris" in excinfo.exconly() )
def test_hill_radius(body, expected_r_SOI): if expected_r_SOI is not None: expected_r_SOI = expected_r_SOI * u.m r_SOI = hill_radius(body, e=0 * u.one) assert_quantity_allclose(r_SOI, expected_r_SOI, rtol=1e-1)
def test_hill_radius_given_a(): parent = Body(None, 1 * u.km**3 / u.s**2, "Parent") body = Body(parent, 1 * u.km**3 / u.s**2, "Body") r_SOI = hill_radius(body, 1 * u.km, 0.25 * u.one) expected_r_SOI = 520.02096 * u.m assert_quantity_allclose(r_SOI, expected_r_SOI, rtol=1e-8)
def test_hill_radius(body, expected_r_SOI): r_SOI = hill_radius(body) assert_quantity_allclose(r_SOI, expected_r_SOI, rtol=1e-1)
def test_hill_radius_given_a(): parent = Body(None, 1 * u.km ** 3 / u.s ** 2, "Parent") body = Body(parent, 1 * u.km ** 3 / u.s ** 2, "Body") r_SOI = hill_radius(body, 1 * u.km, 0.25 * u.one) expected_r_SOI = 520.02096 * u.m assert_quantity_allclose(r_SOI, expected_r_SOI, rtol=1e-8)