More test cases

This commit is contained in:
James R. Barlow
2015-07-28 03:02:35 -07:00
parent bea57bdded
commit e35526192c
4 changed files with 21 additions and 4 deletions
+2
View File
@@ -13,3 +13,5 @@ venv/
bin/
include/
lib/
pip-selfcheck.json
pyvenv.cfg
+6 -3
View File
@@ -642,7 +642,12 @@ def tesseract_ocr_and_render_pdf(
pdfinfo,
pdfinfo_lock):
input_image = next(ii for ii in input_files if ii.endswith('.png'))
input_image = next((ii for ii in input_files if ii.endswith('.png')), '')
input_pdf = next((ii for ii in input_files if ii.endswith('.pdf')))
if not input_image:
# Skipping this page
re_symlink(input_pdf, output_file)
return
args_tesseract = [
'tesseract',
@@ -662,8 +667,6 @@ def tesseract_ocr_and_render_pdf(
log.error(stderr)
except TimeoutError:
p.kill()
input_pdf = next(ii for ii in input_files if ii.endswith('.pdf'))
log.info("Tesseract - page timed out")
re_symlink(input_pdf, output_file)
Binary file not shown.
+13 -1
View File
@@ -134,7 +134,7 @@ def test_force_ocr():
def test_skip_ocr():
out = check_ocrmypdf('graph_ocred.pdf', 'test_skip.pdf', '-s')
check_ocrmypdf('graph_ocred.pdf', 'test_skip.pdf', '-s')
def check_ocr_timeout(renderer):
@@ -155,3 +155,15 @@ def test_skip_big():
pdfinfo = pdf_get_all_pageinfo(out)
assert pdfinfo[0]['has_text'] == False
def check_maximum_options(renderer):
check_ocrmypdf(
'multipage.pdf', 'test_multipage%s.pdf' % renderer,
'-d', '-c', '-i', '-g', '-f', '-k', '--oversample', '300',
'--skip-big', '10', '--title', 'Too Many Weird Files',
'--author', 'py.test', '--pdf-renderer', renderer)
def test_maximum_options():
yield check_maximum_options, 'hocr'
yield check_maximum_options, 'tesseract'