From 77bbc22c5056ca448558486f9608dd7e7e479fd0 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Fri, 9 Aug 2019 01:07:45 -0700 Subject: [PATCH] Ensure --image-dpi on non-image produces a warning --- src/ocrmypdf/_pipeline.py | 2 +- tests/test_main.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ocrmypdf/_pipeline.py b/src/ocrmypdf/_pipeline.py index a485e447..cc7142ba 100644 --- a/src/ocrmypdf/_pipeline.py +++ b/src/ocrmypdf/_pipeline.py @@ -129,7 +129,7 @@ def triage(input_file, output_file, options, log): if _pdf_guess_version(input_file): if options.image_dpi: log.warning( - "Argument --image-dpi ignored because the " + "Argument --image-dpi is being ignored because the " "input file is a PDF, not an image." ) # Origin file is a pdf create a symlink with pdf extension diff --git a/tests/test_main.py b/tests/test_main.py index 52ef343a..d41750de 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1125,3 +1125,14 @@ def test_fast_web_view( ) with pikepdf.open(outpdf) as pdf: assert pdf.is_linearized == expected + + +def test_image_dpi_not_image(caplog, spoof_tesseract_noop, resources, outpdf): + check_ocrmypdf( + resources / 'trivial.pdf', + outpdf, + '--image-dpi', + '100', + env=spoof_tesseract_noop, + ) + assert '--image-dpi is being ignored' in caplog.text