More test cases
This commit is contained in:
@@ -13,3 +13,5 @@ venv/
|
||||
bin/
|
||||
include/
|
||||
lib/
|
||||
pip-selfcheck.json
|
||||
pyvenv.cfg
|
||||
|
||||
+6
-3
@@ -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
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user