Skip to content

Commit b35aa99

Browse files
Strilancbabbush
authored andcommitted
Fix test_dummy_save not deleting its test saved file (#53)
1 parent 3eee403 commit b35aa99

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed
-18.4 KB
Binary file not shown.

src/fermilib/utils/_molecular_data_test.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,20 @@ def test_dummy_save(self):
9595
# Save molecule.
9696
molecule.save()
9797

98-
# Change attributes and load.
99-
molecule.ccsd_energy = -2.232
100-
101-
# Load molecule.
102-
new_molecule = MolecularData(filename=filename)
103-
molecule.load()
104-
105-
# Check CCSD energy.
106-
self.assertAlmostEqual(new_molecule.ccsd_energy, molecule.ccsd_energy)
107-
self.assertAlmostEqual(molecule.ccsd_energy, 88.)
98+
try:
99+
# Change attributes and load.
100+
molecule.ccsd_energy = -2.232
101+
102+
# Load molecule.
103+
new_molecule = MolecularData(filename=filename)
104+
molecule.load()
105+
106+
# Check CCSD energy.
107+
self.assertAlmostEqual(new_molecule.ccsd_energy,
108+
molecule.ccsd_energy)
109+
self.assertAlmostEqual(molecule.ccsd_energy, 88.)
110+
finally:
111+
os.remove(filename + '.hdf5')
108112

109113
def test_energies(self):
110114
self.assertAlmostEqual(self.molecule.hf_energy, -1.1167, places=4)

0 commit comments

Comments
 (0)