Ensure sidecar is not input or output file

This commit is contained in:
James R. Barlow
2021-03-05 00:29:42 -08:00
parent 25c8c4656f
commit 079c162a96
3 changed files with 14 additions and 1 deletions
+8
View File
@@ -18,6 +18,8 @@ from ocrmypdf.cli import get_parser
from ocrmypdf.exceptions import BadArgsError, MissingDependencyError
from ocrmypdf.pdfinfo import PdfInfo
run_ocrmypdf_api = pytest.helpers.run_ocrmypdf_api
def make_opts_pm(input_file='a.pdf', output_file='b.pdf', language='eng', **kwargs):
if language is not None:
@@ -270,3 +272,9 @@ def test_two_languages():
*make_opts_pm(language='fakelang1+fakelang2'), {'fakelang1', 'fakelang2'}
)
mock.assert_called()
def test_sidecar_equals_output(resources, no_outpdf):
op = no_outpdf
with pytest.raises(BadArgsError, match=r'--sidecar'):
run_ocrmypdf_api(resources / 'trivial.pdf', op, '--sidecar', op)