Commit 837c500e authored by Andrea Lorenzon's avatar Andrea Lorenzon 💬
Browse files

fixed test units

parent 1695181a
......@@ -5,13 +5,13 @@ from app import app
class test_extraction(unittest.TestCase):
def test_h5Iterator(self):
from h5ceric import extractDatabase
from modules.h5ceric import extract_dataset
import numpy as np
import settings
ds = extractDatabase(settings.fileFolder, "test.h5", "/entry/mr_scan/mr")
ds = extract_dataset(settings.fileFolder, "test.h5", "/entry/mr_scan/mr")
arr = np.array(ds)
ds1 = extractDatabase(settings.fileFolder,
ds1 = extract_dataset(settings.fileFolder,
"folder1/simulated_images_02.h5",
"/simulated_images/dataset_017")
arr1 = np.array(ds1)
......@@ -23,12 +23,12 @@ class test_extraction(unittest.TestCase):
class test_plotting(unittest.TestCase):
def test_plot(self):
from h5ceric import extractDatabase,plot_dispatcher
from modules.h5ceric import extract_dataset, plot_dispatcher
import settings
from bokeh.plotting import output_file
output_file("templates/testunit.html")
ds = extractDatabase(settings.fileFolder, "test.h5", "/entry/mr_scan/mr")
ds = extract_dataset(settings.fileFolder, "test.h5", "/entry/mr_scan/mr")
p = plot_dispatcher(ds, "/entry/mr_scan/mr")
self.assertEqual(str(type(ds)), "<class 'numpy.ndarray'>")
self.assertEqual(str(type(p)), "<class 'bokeh.plotting.figure.Figure'>")
......@@ -36,17 +36,13 @@ class test_plotting(unittest.TestCase):
# test missing file case
class test_Assertions(unittest.TestCase):
def test_filenoutfound(self):
from h5ceric import extractDatabase
from modules.h5ceric import extract_dataset
import settings
with self.assertRaises(OSError) as context:
extractDatabase(settings.fileFolder, "sbaskjhdlaksjd", "")
extract_dataset(settings.fileFolder, "sbaskjhdlaksjd", "")
self.assertTrue("Unable to open file" in str(context.exception))
if __name__ == '__main__':
unittest.main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment