コード例 #1
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
コード例 #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
コード例 #3
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