Skip to content

Commit

Permalink
[Thermo] add unit tests for add_species_alias and find_isomers
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl authored and Ingmar Schoegl committed Sep 24, 2019
1 parent e8a3842 commit 84a0981
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions interfaces/cython/cantera/test/test_thermo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,23 @@ def test_modify_thermo_invalid(self):
with self.assertRaisesRegex(ct.CanteraError, 'modifySpecies'):
self.gas.modify_species(self.gas.species_index('H2'), copy)

def test_alias(self):
self.gas.add_species_alias('H2', 'hydrogen')
self.assertTrue(self.gas.species_index('hydrogen') == 0)
self.gas.X = 'hydrogen:.5, O2:.5'
self.assertNear(self.gas.X[0], 0.5)
with self.assertRaisesRegex(ct.CanteraError, 'Unable to add alias'):
self.gas.add_species_alias('spam', 'eggs')

def test_isomers(self):
gas = ct.Solution('nDodecane_Reitz.yaml')
iso = gas.find_isomers({'C':4, 'H':9, 'O':2})
self.assertTrue(len(iso) == 2)
iso = gas.find_isomers({'C':7, 'H':15})
self.assertTrue(len(iso) == 1)
iso = gas.find_isomers({'C':7, 'H':16})
self.assertTrue(len(iso) == 0)


class TestSpeciesThermo(utilities.CanteraTest):
h2o_coeffs = [
Expand Down

0 comments on commit 84a0981

Please sign in to comment.