Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F63679042
test_process_files.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
Tue, May 21, 19:31
Size
1 KB
Mime Type
text/x-python
Expires
Thu, May 23, 19:31 (2 d)
Engine
blob
Format
Raw Data
Handle
17805730
Attached To
rNIETZSCHEPYTHON nietzsche-python
test_process_files.py
View Options
import
unittest
from
os
import
sep
,
path
,
remove
from
os.path
import
isfile
import
lxml.etree
as
ET
import
warnings
import
sys
sys
.
path
.
append
(
'svgscripts'
)
import
process_files
from
process_files
import
MyErrorHandler
class
TestProcessFiles
(
unittest
.
TestCase
):
def
setUp
(
self
):
process_files
.
UNITTESTING
=
True
DATADIR
=
path
.
dirname
(
__file__
)
+
sep
+
'test_data'
self
.
dir
=
DATADIR
+
sep
+
'pdfsvg'
self
.
manuscript
=
self
.
dir
+
sep
+
'W_II_1.xml'
self
.
graphic_file
=
self
.
dir
+
sep
+
'W_II_1_page001_web.svg'
@unittest.skipUnless
(
__name__
==
"__main__"
,
'test takes too long, we do not run it with unittest discover'
)
def
test_main
(
self
):
#self.assertEqual(process_files.main([ self.manuscript ]), 1)
argv
=
[
'-g'
,
'-x'
,
self
.
dir
,
'-s'
,
self
.
dir
,
self
.
dir
]
self
.
assertEqual
(
process_files
.
main
(
argv
),
0
)
self
.
assertEqual
(
isfile
(
self
.
graphic_file
),
True
)
def
test_is_page_ok
(
self
):
self
.
assertEqual
(
process_files
.
is_page_ok
(
manuscript_file
=
self
.
manuscript
,
page_number
=
2
),
True
)
def
test_is_svg_ok
(
self
):
self
.
assertEqual
(
process_files
.
is_svg_ok
(
manuscript_file
=
self
.
manuscript
,
page_number
=
1
),
True
)
@unittest.skip
(
''
)
def
test_run
(
self
):
error_handler
=
MyErrorHandler
()
error_handler
.
run
(
page_number
=
'15'
)
if
__name__
==
"__main__"
:
unittest
.
main
()
Event Timeline
Log In to Comment