Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
workflow
ewoksapps
est
Commits
35469b11
Commit
35469b11
authored
Jul 21, 2021
by
payno
Browse files
[ewoks] add test to insure two default graph can be converted to ewoks graph without lost
parent
d5dbfb70
Changes
1
Hide whitespace changes
Inline
Side-by-side
est/test/test_ewoks.py
0 → 100644
View file @
35469b11
from
ewoksorange.owsconvert
import
ows_to_ewoks
,
ewoks_to_ows
from
ewokscore.graph
import
TaskGraph
from
est.core.utils
import
DownloadDataset
import
unittest
import
tempfile
import
shutil
import
os
class
TestOrangeGraph
(
unittest
.
TestCase
):
def
setUp
(
self
)
->
None
:
self
.
folder
=
tempfile
.
mkdtemp
()
file_pymca
=
"ows_files/example_pymca.ows"
file_larch
=
"ows_files/example_larch.ows"
for
file_
in
(
file_larch
,
file_pymca
):
DownloadDataset
(
dataset
=
file_
,
output_folder
=
self
.
folder
,
timeout
=
2.0
)
self
.
_example_pymca_ows
=
os
.
path
.
join
(
self
.
folder
,
"example_pymca.ows"
)
self
.
_example_larch_ows
=
os
.
path
.
join
(
self
.
folder
,
"example_larch.ows"
)
assert
os
.
path
.
exists
(
self
.
_example_larch_ows
)
assert
os
.
path
.
exists
(
self
.
_example_pymca_ows
)
def
tearDown
(
self
)
->
None
:
shutil
.
rmtree
(
self
.
folder
)
def
test_orange_graph_to_ewo_graph_pymca
(
self
):
"""test conversion of a workflow based on pymca to ewoks graph"""
graph
=
ows_to_ewoks
(
self
.
_example_pymca_ows
)
self
.
assertTrue
(
isinstance
(
graph
,
TaskGraph
))
self
.
assertEqual
(
len
(
graph
.
start_nodes
()),
1
)
self
.
assertTrue
(
"input"
in
graph
.
start_nodes
())
for
node
in
(
"input"
,
"output"
,
"normalization"
,
"exafs"
,
"k weight"
,
"fourier transform"
,
):
self
.
assertTrue
(
node
in
graph
.
graph
.
nodes
())
self
.
assertEqual
(
len
(
graph
.
graph
.
edges
),
5
)
def
test_orange_graph_to_ewo_graph_larch
(
self
):
"""test conversion of a workflow based on pymca to ewoks graph"""
graph
=
ows_to_ewoks
(
self
.
_example_larch_ows
)
self
.
assertTrue
(
isinstance
(
graph
,
TaskGraph
))
self
.
assertEqual
(
len
(
graph
.
start_nodes
()),
1
)
self
.
assertTrue
(
"input"
in
graph
.
start_nodes
())
for
node
in
(
"input"
,
"output"
,
"pre edge"
,
"autobk"
,
"xftf"
):
self
.
assertTrue
(
node
in
graph
.
graph
.
nodes
())
self
.
assertEqual
(
len
(
graph
.
graph
.
edges
),
4
)
Write
Preview
Supports
Markdown
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