Esempio n. 1
0
def test_orbital_period():
    planet = Planet(SUN)
    planet.mass = planet.earth_in_solar_masses
    planet.axis = 1
    assert round(planet.orbital_period(), 2) == 365.25
    planet.axis = 5.2
    assert round(planet.orbital_period(), 2) == 4331.13
Esempio n. 2
0
def test_radius():
    planet = Planet(SUN)
    planet.mass = planet.earth_in_solar_masses
    assert round(planet.radius(), 2) == 6403.97
    planet.gas_giant = True
    planet.mass *= 20
    assert round(planet.radius(), 2) == 25382.72
Esempio n. 3
0
def test_gas_giant_density():
    planet = Planet(SUN)
    planet.mass = planet.earth_in_solar_masses
    planet.gas_giant = True
    assert planet.density() == 1.2
    planet.mass *= 2.0
    assert round(planet.density(), 2) == 1.31
Esempio n. 4
0
def test_regular_density():
    planet = Planet(SUN)
    planet.mass = planet.earth_in_solar_masses
    assert round(planet.density(), 2) == 5.43
    planet.gas_giant = True
    planet.mass *= 20
    assert round(planet.density(), 2) == 1.75
Esempio n. 5
0
def test_axial_tilt():
    planet = Planet(SUN)
    planet.mass = planet.earth_in_solar_masses
    planet.axis = 1
    tilts = set()
    for i in range(0, 100):
        tilts.add(Planet(SUN).axial_tilt())
    assert len(tilts) > 0
    assert min(tilts) > 0
    assert max(tilts) < 360
Esempio n. 6
0
def test_surface_acceleration():
    planet = Planet(SUN)
    planet.mass = planet.earth_in_solar_masses
    assert round(planet.surface_acceleration(), 2) == 972.39
Esempio n. 7
0
def test_escape_velocity():
    planet = Planet(SUN)
    planet.mass = planet.earth_in_solar_masses
    assert round(planet.escape_velocity(), -3) == 1116000
    planet.mass = planet.earth_in_solar_masses * 0.107
    assert round(planet.escape_velocity(), -3) == 527000
Esempio n. 8
0
def test_day():
    planet = Planet(SUN)
    planet.mass = planet.earth_in_solar_masses
    planet.axis = 1
    planet.star.specified_age = 4.6e9
    assert round(planet.day(), 2) == 16.21
Esempio n. 9
0
def test_earth_mass():
    planet = Planet(SUN)
    planet.mass = 1.0
    assert planet.earth_mass() == 332775.64
    planet.mass = planet.earth_in_solar_masses
    assert planet.earth_mass() == 1.0