Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F60686948
test_simple_word.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
Wed, May 1, 23:18
Size
1 KB
Mime Type
text/x-python
Expires
Fri, May 3, 23:18 (2 d)
Engine
blob
Format
Raw Data
Handle
17396604
Attached To
rNIETZSCHEPYTHON nietzsche-python
test_simple_word.py
View Options
import
unittest
from
os
import
sep
,
path
from
os.path
import
dirname
,
isdir
import
lxml.etree
as
ET
import
re
import
sys
sys
.
path
.
append
(
'svgscripts'
)
from
datatypes.matrix
import
Matrix
from
datatypes.transkriptionField
import
TranskriptionField
from
datatypes.transkription_position
import
TranskriptionPosition
from
datatypes.simple_word
import
SimpleWord
from
datatypes.mark_foreign_hands
import
MarkForeignHands
from
datatypes.word
import
Word
class
TestSimpleWord
(
unittest
.
TestCase
):
def
test_get_semanticAndDataDict
(
self
):
dictionary
=
SimpleWord
.
get_semantic_dictionary
()
#print(dictionary)
def
test_create_cls_from_word
(
self
):
word
=
Word
(
text
=
'test'
)
mark
=
MarkForeignHands
.
create_cls_from_word
(
word
)
self
.
assertEqual
(
mark
.
text
,
word
.
text
)
self
.
assertEqual
(
type
(
mark
),
MarkForeignHands
)
def
test_attach
(
self
):
word
=
SimpleWord
()
word
.
transkription_positions
.
append
(
TranskriptionPosition
(
id
=
0
))
word
.
transkription_positions
.
append
(
TranskriptionPosition
(
id
=
0
))
tree
=
ET
.
Element
(
'page'
)
word
.
attach_word_to_tree
(
tree
)
self
.
assertEqual
(
len
(
tree
.
xpath
(
'//'
+
TranskriptionPosition
.
XML_TAG
)),
2
)
def
test_clean_text
(
self
):
word
=
SimpleWord
()
self
.
assertEqual
(
word
.
_create_clean_text
(
'-asdf'
),
'asdf'
)
self
.
assertEqual
(
word
.
_create_clean_text
(
'(-asdf)'
),
'asdf'
)
self
.
assertEqual
(
word
.
_create_clean_text
(
'(a.)'
),
'a.'
)
self
.
assertEqual
(
word
.
_create_clean_text
(
'.verhehlen'
),
'verhehlen'
)
if
__name__
==
"__main__"
:
unittest
.
main
()
Event Timeline
Log In to Comment