Page MenuHomec4science

test_editor_comment.py
No OneTemporary

File Metadata

Created
Sat, May 4, 11:00

test_editor_comment.py

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