Пример #1
0
def test_gas_initialization():
    with pytest.raises(TypeError):
        # pylint: disable=no-value-for-parameter
        balloon.Gas()
    g = balloon.Gas('air')
    assert g.species == 'air'
    assert g.temperature == balloon.STANDARD_TEMPERATURE_K
    assert g.pressure == balloon.STANDARD_PRESSURE_Pa
    assert g.mass == 0
    assert g.molar_mass == 0.02897
Пример #2
0
def test_balloon_burst_threshold():
    g = balloon.Gas('air', mass=1)
    b = balloon.Balloon('HAB-3000', lift_gas=g)
    # override volume
    b.match_conditions(100, .001)
    assert b.burst_threshold_exceeded == True
    b.match_conditions(.001, 1000)
    assert b.burst_threshold_exceeded == False
Пример #3
0
def test_balloon_with_gas():
    g = balloon.Gas('air', mass=1)
    b = balloon.Balloon('HAB-3000', lift_gas=g)
    assert b.volume == g.volume
Пример #4
0
def test_balloon_initialization():
    b = balloon.Balloon('HAB-3000')
    assert b.name == 'HAB-3000'
    assert type(b.lift_gas) == type(balloon.Gas('air'))
    assert b.mass == 3.0
Пример #5
0
def test_gas_match_conditions():
    g = balloon.Gas('air', mass=0)
    g.match_conditions(1, 100)
    assert g.temperature == 1
    assert g.pressure == 100
Пример #6
0
def test_gas_match_ambient():
    atmosphere = 'conditions at 100m altitude'
    g = balloon.Gas('air', mass=0)
    g.match_ambient(atmosphere)
    assert g.temperature == np.array([287.50001023])
    assert g.pressure == np.array([100129.45645595])
Пример #7
0
def test_gas_mass():
    g = balloon.Gas('air', mass=1)
    assert g.volume == 0.38806961845979154
    assert g.density == 2.5768572246621555
Пример #8
0
def test_gas_massless():
    g = balloon.Gas('air', mass=0)
    assert g.volume == 0
    assert g.density == 2.5768572246621555