Page MenuHomec4science

test_path.py
No OneTemporary

File Metadata

Created
Thu, May 9, 13:45

test_path.py

import unittest
from os import sep, path
from os.path import isdir, dirname, basename
import lxml.etree as ET
from svgpathtools.parser import parse_path
import sys
import sys
sys.path.append('svgscripts')
from datatypes.path import Path
class TestPath(unittest.TestCase):
def test_init(self):
tag = 'word-deletion-path'
path = Path(tag=tag, path=parse_path('M 0, 0 L 10, 0 L 10, 10 L 0, 10 z'), style_class='st10')
self.assertEqual(path.tag, tag)
self.assertEqual(path.path.isclosed(), True)
def test_attach_object_to_tree(self):
tag = 'word-deletion-path'
svg_path = parse_path('M 0, 0 L 10, 0 L 10, 10 L 0, 10 z')
path = Path(tag=tag, path=svg_path, style_class='st10')
empty_tree = ET.ElementTree(ET.Element('page'))
path.attach_object_to_tree(empty_tree)
self.assertEqual(path.tag, tag)
for node in empty_tree.getroot().xpath('//' + path.tag):
self.assertEqual(node.get('id'), '0')
self.assertEqual(parse_path(node.get('d')), svg_path)
def test_get_semantic_dict(self):
#print(Path.get_semantic_dictionary())
pass
if __name__ == "__main__":
unittest.main()

Event Timeline