Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F60469653
test_earlier_description.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
Tue, Apr 30, 11:28
Size
1 KB
Mime Type
text/x-python
Expires
Thu, May 2, 11:28 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
17355760
Attached To
rNIETZSCHEPYTHON nietzsche-python
test_earlier_description.py
View Options
import
unittest
from
os
import
sep
,
path
from
os.path
import
dirname
,
basename
,
isfile
,
isdir
import
lxml.etree
as
ET
import
sys
sys
.
path
.
append
(
'svgscripts'
)
from
datatypes.page
import
Page
from
datatypes.earlier_description
import
EarlierDescription
class
TestEarlierDescription
(
unittest
.
TestCase
):
def
setUp
(
self
):
DATADIR
=
dirname
(
__file__
)
+
sep
+
'test_data'
if
not
isdir
(
DATADIR
):
DATADIR
=
dirname
(
dirname
(
__file__
))
+
sep
+
'test_data'
self
.
test_file
=
DATADIR
+
sep
+
'test.xml'
self
.
test_svg_file
=
DATADIR
+
sep
+
'test421.svg'
self
.
pdf_xml
=
DATADIR
+
sep
+
'W_I_8_page125.xml'
self
.
xml_file
=
DATADIR
+
sep
+
'N_VII_1_page005.xml'
self
.
xml_fileB
=
DATADIR
+
sep
+
'N_VII_1_page006.xml'
self
.
pdf_xml_source
=
DATADIR
+
sep
+
'W_I_8_neu_125-01.svg'
self
.
test_page
=
DATADIR
+
sep
+
'N_VII_1_page001.xml'
self
.
test_manuscript
=
DATADIR
+
sep
+
'N_VII_1.xml'
def
test_semantic
(
self
):
pass
#print(EarlierDescription.get_semantic_dictionary())
def
test_create_cls_from_node
(
self
):
tree
=
ET
.
parse
(
self
.
test_manuscript
)
node
=
tree
.
xpath
(
'description/earlierDescription[@id="1"]'
)[
0
]
description
=
EarlierDescription
.
create_cls_from_node
(
node
)
self
.
assertTrue
(
description
.
author
is
not
None
)
self
.
assertTrue
(
description
.
citation
is
not
None
)
self
.
assertTrue
(
len
(
description
.
standoff_markups
)
>
0
)
if
__name__
==
"__main__"
:
unittest
.
main
()
Event Timeline
Log In to Comment