Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61881127
test_path.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
Thu, May 9, 13:45
Size
1 KB
Mime Type
text/x-python
Expires
Sat, May 11, 13:45 (2 d)
Engine
blob
Format
Raw Data
Handle
17571556
Attached To
rNIETZSCHEPYTHON nietzsche-python
test_path.py
View Options
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
Log In to Comment