2019-10-26 16:42:33 +00:00
|
|
|
from tempfile import NamedTemporaryFile
|
2016-11-08 19:01:11 +00:00
|
|
|
|
2019-10-26 16:42:33 +00:00
|
|
|
from helpers import absolute_sample_path
|
|
|
|
from tools import dumppdf
|
2014-09-03 11:17:41 +00:00
|
|
|
|
|
|
|
|
2019-10-26 16:42:33 +00:00
|
|
|
def run(filename, options=None):
|
|
|
|
absolute_path = absolute_sample_path(filename)
|
|
|
|
with NamedTemporaryFile() as output_file:
|
|
|
|
if options:
|
|
|
|
s = 'dumppdf -o%s %s %s' % (output_file.name, options, absolute_path)
|
|
|
|
else:
|
|
|
|
s = 'dumppdf -o%s %s' % (output_file.name, absolute_path)
|
|
|
|
dumppdf.main(s.split(' '))
|
2014-09-03 11:17:41 +00:00
|
|
|
|
|
|
|
|
2014-09-04 07:36:19 +00:00
|
|
|
class TestDumpPDF():
|
2014-09-03 11:17:41 +00:00
|
|
|
def test_1(self):
|
2019-10-26 16:42:33 +00:00
|
|
|
run('jo.pdf', '-t -a')
|
|
|
|
run('simple1.pdf', '-t -a')
|
|
|
|
run('simple2.pdf', '-t -a')
|
|
|
|
run('simple3.pdf', '-t -a')
|
|
|
|
|
2014-09-03 11:17:41 +00:00
|
|
|
def test_2(self):
|
2019-10-26 16:42:33 +00:00
|
|
|
run('nonfree/dmca.pdf', '-t -a')
|
|
|
|
|
2014-09-03 11:17:41 +00:00
|
|
|
def test_3(self):
|
2019-10-26 16:42:33 +00:00
|
|
|
run('nonfree/f1040nr.pdf')
|
2014-09-03 11:17:41 +00:00
|
|
|
|
|
|
|
def test_4(self):
|
2019-10-26 16:42:33 +00:00
|
|
|
run('nonfree/i1040nr.pdf')
|
|
|
|
|
2014-09-03 11:17:41 +00:00
|
|
|
def test_5(self):
|
2019-10-26 16:42:33 +00:00
|
|
|
run('nonfree/kampo.pdf', '-t -a')
|
2014-09-03 11:17:41 +00:00
|
|
|
|
2019-10-26 16:42:33 +00:00
|
|
|
def test_6(self):
|
|
|
|
run('nonfree/naacl06-shinyama.pdf', '-t -a')
|