Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Andrea Lorenzon
H5nuvola2
Commits
837c500e
Commit
837c500e
authored
Aug 05, 2021
by
Andrea Lorenzon
💬
Browse files
fixed test units
parent
1695181a
Changes
1
Hide whitespace changes
Inline
Side-by-side
test_app.py
View file @
837c500e
...
...
@@ -5,13 +5,13 @@ from app import app
class
test_extraction
(
unittest
.
TestCase
):
def
test_h5Iterator
(
self
):
from
h5ceric
import
extract
D
ata
ba
se
from
modules.
h5ceric
import
extract
_d
atase
t
import
numpy
as
np
import
settings
ds
=
extract
D
ata
ba
se
(
settings
.
fileFolder
,
"test.h5"
,
"/entry/mr_scan/mr"
)
ds
=
extract
_d
atase
t
(
settings
.
fileFolder
,
"test.h5"
,
"/entry/mr_scan/mr"
)
arr
=
np
.
array
(
ds
)
ds1
=
extract
D
ata
ba
se
(
settings
.
fileFolder
,
ds1
=
extract
_d
atase
t
(
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
extract
D
ata
base
,
plot_dispatcher
from
modules.
h5ceric
import
extract
_d
ata
set
,
plot_dispatcher
import
settings
from
bokeh.plotting
import
output_file
output_file
(
"templates/testunit.html"
)
ds
=
extract
D
ata
ba
se
(
settings
.
fileFolder
,
"test.h5"
,
"/entry/mr_scan/mr"
)
ds
=
extract
_d
atase
t
(
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
extract
D
ata
ba
se
from
modules.
h5ceric
import
extract
_d
atase
t
import
settings
with
self
.
assertRaises
(
OSError
)
as
context
:
extract
D
ata
ba
se
(
settings
.
fileFolder
,
"sbaskjhdlaksjd"
,
""
)
extract
_d
atase
t
(
settings
.
fileFolder
,
"sbaskjhdlaksjd"
,
""
)
self
.
assertTrue
(
"Unable to open file"
in
str
(
context
.
exception
))
if
__name__
==
'__main__'
:
unittest
.
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment