Пример #1
0
def test_body_from_parameters_raises_valueerror_if_k_units_not_correct():
    wrong_k = 4902.8 * u.kg
    _name = _symbol = ""
    _R = 0
    with pytest.raises(u.UnitsError) as excinfo:
        Body.from_parameters(None, wrong_k, _name, _symbol, _R)
    assert (
        "UnitsError: Argument 'k' to function 'from_parameters' must be in units convertible to 'km3 / s2'."
        in excinfo.exconly())
Пример #2
0
def test_body_from_parameters_returns_body_object():
    k = 1.26712763e17 * u.m**3 / u.s**2
    R = 71492000 * u.m
    _name = _symbol = "jupiter"
    jupiter = Body.from_parameters(Sun, k, _name, _symbol, Jupiter.R)

    assert jupiter.k == k
    assert jupiter.R == R