Skip to content

Commit

Permalink
Bugfix for file not closing in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dineshpinto committed Sep 30, 2023
1 parent 5592986 commit bc50244
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion tests/test_fitting.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import logging
from pathlib import Path
from unittest import TestCase

from qudi_hira_analysis import DataHandler

logging.disable(logging.CRITICAL)


class TestFitting(TestCase):
def setUp(self) -> None:
Expand Down Expand Up @@ -67,4 +70,4 @@ def test_saturation_hyperbolicsaturation_fit(self):
fit_function=self.dh.fit_function.hyperbolicsaturation
)
self.assertAlmostEqual(x_fit.tolist()[0], 0.83)
self.assertAlmostEqual(int(y_fit[0]), 54533, places=0)
self.assertAlmostEqual(int(y_fit[0]), 54531, places=0)
6 changes: 5 additions & 1 deletion tests/test_loading.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import logging
from pathlib import Path
from unittest import TestCase

from qudi_hira_analysis import DataHandler

logging.disable(logging.CRITICAL)


class TestLoading(TestCase):
def setUp(self) -> None:
Expand Down Expand Up @@ -77,6 +80,7 @@ def test_bruker_mfm_load(self):

self.assertEqual(mfm.channel, "Phase")
self.assertEqual(mfm.type, "Bruker MFM")
bruker_data.file.close()

def test_pys_load(self):
pys_measurements = self.dh.load_measurements(measurement_str="ndmin",
Expand All @@ -96,7 +100,7 @@ def test_temperature_monitoring_load(self):
qudi=False)
temp = temps[next(iter(temps))].data
self.assertIn("Tip Holder", temp.columns)
self.assertAlmostEqual(temp.iloc[0][0], 119.403)
self.assertAlmostEqual(temp.iloc[0, 0], 119.403)

def test_measurement_dataclass(self):
odmr_list = self.dh.load_measurements(measurement_str="ODMR", pulsed=True)
Expand Down

0 comments on commit bc50244

Please sign in to comment.