pdfminer.six/tests/test_tools_dumppdf.py

54 lines
1.4 KiB
Python
Raw Normal View History

#!/usr/bin/env python
2014-09-03 11:17:41 +00:00
# -*- coding: utf-8 -*-
import six
2014-09-03 11:17:41 +00:00
2014-09-04 07:36:19 +00:00
import nose, logging, os
2014-09-03 11:17:41 +00:00
if six.PY3:
from tools import dumppdf
elif six.PY2:
import os, sys
sys.path.append(os.path.abspath(os.path.curdir))
import tools.dumppdf as dumppdf
2014-09-03 11:17:41 +00:00
path=os.path.dirname(os.path.abspath(__file__))+'/'
def run(datapath,filename,options=None):
i=path+datapath+filename+'.pdf'
o=path+filename+'.xml'
if options:
s='dumppdf -o%s %s %s'%(o,options,i)
else:
s='dumppdf -o%s %s'%(o,i)
dumppdf.main(s.split(' '))
2014-09-04 07:36:19 +00:00
class TestDumpPDF():
2014-09-03 11:17:41 +00:00
def test_1(self):
run('../samples/','jo','-t -a')
run('../samples/','simple1','-t -a')
run('../samples/','simple2','-t -a')
run('../samples/','simple3','-t -a')
def test_2(self):
run('../samples/nonfree/','dmca','-t -a')
def test_3(self):
run('../samples/nonfree/','f1040nr')
def test_4(self):
run('../samples/nonfree/','i1040nr')
def test_5(self):
run('../samples/nonfree/','kampo','-t -a')
def test_6(self):
run('../samples/nonfree/','naacl06-shinyama','-t -a')
if __name__ == '__main__':
2014-09-04 07:36:19 +00:00
#import logging,sys,os,six
#logging.basicConfig(level=logging.DEBUG, filename='%s_%d.%d.log'%(os.path.basename(__file__),sys.version_info[0],sys.version_info[1]))
nose.runmodule()