Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F80566653
test_py2ttl_data.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Sep 1, 10:23
Size
1 KB
Mime Type
text/x-python
Expires
Tue, Sep 3, 10:23 (2 d)
Engine
blob
Format
Raw Data
Handle
20396027
Attached To
rNIETZSCHEPYTHON nietzsche-python
test_py2ttl_data.py
View Options
import
unittest
import
lxml.etree
as
ET
from
os
import
sep
,
path
,
remove
from
os.path
import
isfile
,
dirname
from
rdflib
import
Graph
,
URIRef
,
Literal
import
sys
sys
.
path
.
append
(
'py2ttl'
)
import
py2ttl_data
from
py2ttl_data
import
Py2TTLDataConverter
from
config
import
PROJECT_NAME
,
PROJECT_ONTOLOGY_FILE
from
knora_base
import
KNORA_BASE
if
dirname
(
dirname
(
__file__
))
not
in
sys
.
path
:
sys
.
path
.
append
(
dirname
(
dirname
(
__file__
)))
from
svgscripts.datatypes.word
import
Word
from
svgscripts.datatypes.word_position
import
WordPosition
class
TestPy2TTL
(
unittest
.
TestCase
):
"""This is the unittest for py2ttl.py2ttl.
@label unittest
"""
def
setUp
(
self
):
DATADIR
=
dirname
(
__file__
)
+
sep
+
'test_data'
self
.
manuscript_file
=
DATADIR
+
sep
+
'N_VII_1.xml'
self
.
ttl_target
=
__file__
+
'test.ttl'
self
.
dictionary_file
=
DATADIR
+
sep
+
'mapping_dict.xml'
def
test_main
(
self
):
Py2TTLDataConverter
.
UNITTESTING
=
True
argv
=
[
self
.
manuscript_file
]
self
.
assertEqual
(
py2ttl_data
.
main
(
argv
),
0
)
def
test_convert
(
self
):
converter
=
Py2TTLDataConverter
(
self
.
manuscript_file
,
xml_dictionary_file
=
self
.
dictionary_file
)
converter
.
convert
(
create_or_update_changed_pages
=
True
)
def
tearDown
(
self
):
isfile
(
self
.
ttl_target
)
and
remove
(
self
.
ttl_target
)
if
__name__
==
"__main__"
:
unittest
.
main
()
Event Timeline
Log In to Comment