Example #1
0
def test_iterating_over_raw_velocity():
    velocity = units.Velocity(au_per_d=1.234)
    with assert_raises(units.UnpackingError):
        x, y, z = velocity
Example #2
0
def test_converting_velocity_with_astropy():
    velocity = units.Velocity(au_per_d=1.234)
    value1 = velocity.km_per_s
    value2 = velocity.to(u.km / u.s)
    epsilon = 1e-6
    assert abs(value1 - value2.value) < epsilon
Example #3
0
def test_velocity_input_units():
    v1 = units.Velocity(au_per_d=2.0)
    v2 = units.Velocity(km_per_s=3462.9137)
    assert abs(v1.au_per_d - v2.au_per_d) < 1e-7