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
cubicweb
OWL2YAMS
Commits
4a98155b6c34
Commit
4a98155b
authored
Oct 26, 2021
by
Fabien Amarger
Browse files
feat(test): Change how to declare test
parent
958ac60aedc2
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/test_owl2yams.py
View file @
4a98155b
import
unittest
import
pathlib
from
rdflib
import
Graph
from
typing
import
Optional
from
owl2yams
import
owl_model_to_yams
from
yams.serialize
import
serialize_to_python
...
...
@@ -8,11 +9,12 @@
class
Owl2YamsTC
(
unittest
.
TestCase
):
def
test_transform_owl_to_yams
(
self
):
data_input
=
TEST_DATA
/
"model.owl"
expected_output
=
TEST_DATA
/
"expected_schema.yams"
def
_load_owl_and_yams
(
self
,
owl_model_file_name
:
str
,
yams_schema_file_name
:
Optional
[
str
]
=
None
):
data_input
=
TEST_DATA
/
owl_model_file_name
owl_model
=
Graph
()
owl_model
.
parse
(
str
(
data_input
),
format
=
"turtle"
)
schema
=
owl_model_to_yams
(
owl_model
,
"TEST"
)
...
...
@@ -14,11 +16,17 @@
owl_model
=
Graph
()
owl_model
.
parse
(
str
(
data_input
),
format
=
"turtle"
)
schema
=
owl_model_to_yams
(
owl_model
,
"TEST"
)
with
open
(
expected_output
)
as
f
:
expected_yams_schema
=
f
.
read
()
self
.
assertEquals
(
serialize_to_python
(
schema
),
expected_yams_schema
)
if
yams_schema_file_name
is
not
None
:
expected_output
=
TEST_DATA
/
yams_schema_file_name
with
open
(
expected_output
)
as
f
:
expected_yams_schema
=
f
.
read
()
self
.
assertEquals
(
serialize_to_python
(
schema
),
expected_yams_schema
)
return
schema
def
test_transform_owl_to_yams
(
self
):
self
.
_load_owl_and_yams
(
"model.owl"
,
"expected_schema.yams"
)
if
__name__
==
"__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