Skip to content

Commit

Permalink
[Tests] address review comments for legacy hdf5 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
g3bk47 authored and speth committed Oct 2, 2023
1 parent bcbf442 commit 329952d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/python/test_onedim.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,8 @@ def test_restore_legacy_hdf(self):
assert meta['description'] == desc
assert meta['cantera_version'] == "2.6.0"

# check with reduced tolerance to account for machine dependent differences
# check with relaxed tolerances to account for differences between
# Cantera 2.6 and Cantera 3.1
self.check_save_restore(f, tol_T=1e-3, tol_X=1e-1)

@pytest.mark.skipif("native" not in ct.hdf_support(),
Expand Down Expand Up @@ -786,7 +787,7 @@ def run_save_restore(self, mode):

self.check_save_restore(f)

def check_save_restore(self, f, tol_T=1e-4, tol_X=1e-4):
def check_save_restore(self, f, tol_T=None, tol_X=None):
# pytest.approx is used as equality for floats cannot be guaranteed for loaded
# HDF5 files if they were created on a different OS and/or architecture
assert list(f.grid) == pytest.approx(list(self.sim.grid))
Expand Down Expand Up @@ -1550,6 +1551,9 @@ def test_restore_legacy_hdf(self):
self.run_reacting_surface(xch4=0.095, tsurf=900.0, mdot=0.06, width=0.1)
jet = ct.ImpingingJet(gas=self.gas, surface=self.surf_phase)
jet.restore(filename, "group0")

# check with relaxed tolerances to account for differences between
# Cantera 2.6 and Cantera 3.1
self.check_save_restore(jet, tol_T=1e-3, tol_X=1e-1)

@pytest.mark.skipif("native" not in ct.hdf_support(),
Expand All @@ -1573,7 +1577,7 @@ def run_save_restore(self, mode):

self.check_save_restore(jet)

def check_save_restore(self, jet, tol_T=1e-3, tol_X=1e-4):
def check_save_restore(self, jet, tol_T=None, tol_X=None):
# pytest.approx is used as equality for floats cannot be guaranteed for loaded
# HDF5 files if they were created on a different OS and/or architecture
assert list(jet.grid) == pytest.approx(list(self.sim.grid))
Expand Down

0 comments on commit 329952d

Please sign in to comment.