uncscode / particula

a simple, fast, and powerful particle simulator
https://uncscode.github.io/particula
MIT License
6 stars 9 forks source link

Expand Gas builder test #483

Open Gorkowski opened 1 month ago

Gorkowski commented 1 month ago

suggestion (testing): Enhance test_gas_builder_with_species with more detailed assertions

Consider adding assertions to verify the properties of the added species in the atmosphere. This would ensure that the species are correctly added and their properties are preserved.

def test_gas_builder_with_species(): """Test building a Gas object with the GasBuilder.""" vapor_pressure_strategy_atmo = ConstantVaporPressureStrategy( vapor_pressure=np.array([101325, 101325, 101325])) names_atmo = np.array(["Oxygen", "Nitrogen", "Carbon Dioxide"]) molar_masses_atmo = np.array([0.032, 0.028, 0.044]) condensables_atmo = np.array([False, False, True]) concentrations_atmo = np.array([0.21, 0.79, 0.0]) gas_species_builder_test = GasSpecies( name=names_atmo, molar_mass=molar_masses_atmo, vapor_pressure_strategy=vapor_pressure_strategy_atmo, condensable=condensables_atmo, concentration=concentrations_atmo ) atmo = ( AtmosphereBuilder() .set_temperature(298.15) .set_pressure(101325) .add_species(gas_species_builder_test) .build() )

assert atmo.temperature == 298.15
assert atmo.total_pressure == 101325
assert len(atmo.species) == 1
assert np.array_equal(atmo.species[0].name, names_atmo)
assert np.array_equal(atmo.species[0].molar_mass, molar_masses_atmo)
assert np.array_equal(atmo.species[0].condensable, condensables_atmo)
assert np.array_equal(atmo.species[0].concentration, concentrations_atmo)