Skip to content

Commit

Permalink
[test] removed useless fixtures in test_transport
Browse files Browse the repository at this point in the history
  • Loading branch information
wandadars authored and speth committed Oct 20, 2024
1 parent 907a594 commit 4a954f9
Showing 1 changed file with 15 additions and 21 deletions.
36 changes: 15 additions & 21 deletions test/python/test_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,31 +215,33 @@ def gas(self):
gas.TPX = 2237, ct.one_atm, 'O2:0.7010, H2O:0.1885, CO2:9.558e-2'
return gas

@pytest.fixture(scope='function')
def N2_idx(self, gas):
return gas.species_index("N2")

@pytest.fixture(scope='function')
def H3Op_idx(self, gas):
return gas.species_index("H3O+")
def test_binary_diffusion(self, gas):
N2_idx = gas.species_index("N2")
H3Op_idx = gas.species_index("H3O+")

def test_binary_diffusion(self, gas, N2_idx, H3Op_idx):
bdiff = gas.binary_diff_coeffs[N2_idx][H3Op_idx]
assert bdiff == approx(4.258e-4, rel=1e-4) # Regression test

def test_mixture_diffusion(self, gas, H3Op_idx):
def test_mixture_diffusion(self, gas):
H3Op_idx = gas.species_index("H3O+")

mdiff = gas.mix_diff_coeffs[H3Op_idx]
assert mdiff == approx(5.057e-4, rel=1e-4) # Regression test

def test_O2_anion_mixture_diffusion(self, gas):
mdiff = gas['O2-'].mix_diff_coeffs[0]
assert mdiff == approx(2.784e-4, rel=1e-3) # Regression test

def test_mobility(self, gas, H3Op_idx):
def test_mobility(self, gas):
H3Op_idx = gas.species_index("H3O+")

mobi = gas.mobilities[H3Op_idx]
assert mobi == approx(2.623e-3, rel=1e-4) # Regression test

def test_update_temperature(self, gas, N2_idx, H3Op_idx):
def test_update_temperature(self, gas):
N2_idx = gas.species_index("N2")
H3Op_idx = gas.species_index("H3O+")

bdiff = gas.binary_diff_coeffs[N2_idx][H3Op_idx]
mdiff = gas.mix_diff_coeffs[H3Op_idx]
mobi = gas.mobilities[H3Op_idx]
Expand Down Expand Up @@ -318,18 +320,10 @@ def test_bad_geometry(self):

class TestDustyGas:

@pytest.fixture(scope='class')
def initial_conditions(self):
return {
'T': 500.0,
'P': ct.one_atm,
'X': "O2:2.0, H2:1.0, H2O:1.0"
}

@pytest.fixture
def phase(self, initial_conditions):
def phase(self):
phase = ct.DustyGas("h2o2.yaml")
phase.TPX = initial_conditions['T'], initial_conditions['P'], initial_conditions['X']
phase.TPX = 500.0, ct.one_atm, "O2:2.0, H2:1.0, H2O:1.0"
phase.porosity = 0.2
phase.tortuosity = 0.3
phase.mean_pore_radius = 1e-4
Expand Down

0 comments on commit 4a954f9

Please sign in to comment.