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
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
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
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
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
def test_surface_acceleration(): planet = Planet(SUN) planet.mass = planet.earth_in_solar_masses assert round(planet.surface_acceleration(), 2) == 972.39
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
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
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