Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61086048
test_editor_comment.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
Sat, May 4, 11:00
Size
1 KB
Mime Type
text/x-python
Expires
Mon, May 6, 11:00 (2 d)
Engine
blob
Format
Raw Data
Handle
17362604
Attached To
rNIETZSCHEPYTHON nietzsche-python
test_editor_comment.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.editor_comment
import
EditorComment
from
datatypes.clarification
import
Clarification
class
TestEditorComment
(
unittest
.
TestCase
):
def
test_attach
(
self
):
comment
=
EditorComment
(
comment
=
"test"
)
tree
=
ET
.
ElementTree
(
ET
.
Element
(
'asdf'
))
comment
.
attach_object_to_tree
(
tree
)
commentB
=
EditorComment
.
create_cls_from_node
(
tree
.
xpath
(
EditorComment
.
XML_TAG
)[
0
])
self
.
assertEqual
(
commentB
.
is_uncertain
,
comment
.
is_uncertain
)
#print(ET.dump(tree.getroot()))
def
test_semantic
(
self
):
pass
#print(EditorComment.get_semantic_dictionary())
@unittest.skip
(
'tested with local file'
)
def
test_create_cls_from_node
(
self
):
tree
=
ET
.
parse
(
'xml/N_VII_1_page005.xml'
)
node
=
tree
.
xpath
(
'//'
+
EditorComment
.
XML_TAG
)[
0
]
comment
=
EditorComment
.
create_cls_from_node
(
node
)
self
.
assertEqual
(
type
(
comment
),
Clarification
)
page
=
Page
(
'xml/N_VII_1_page005.xml'
)
word
=
[
word
for
word
in
page
.
words
if
word
.
text
==
'Geschehen'
][
0
]
self
.
assertEqual
(
type
(
word
.
editor_comment
),
Clarification
)
if
__name__
==
"__main__"
:
unittest
.
main
()
Event Timeline
Log In to Comment