create non-ascii filename test cases dynamically instead of static PDF

originally PDF files were included for these edge-cases but in
reality all we want to test is the filename itself. So it reduces
repo size if we have them generated dynamically.
This commit is contained in:
deeplow 2022-09-13 13:04:13 +01:00
parent d5eefeab3d
commit 0f4e6e9156
No known key found for this signature in database
GPG key ID: 577982871529A52A

View file

@ -1,5 +1,7 @@
from __future__ import annotations from __future__ import annotations
import os
import shutil
import tempfile import tempfile
import pytest import pytest
@ -68,3 +70,18 @@ class TestCliConversion(TestCliBasic):
def test_lang_eng(self): def test_lang_eng(self):
result = self.run_cli(f'"{self.sample_doc}" --ocr-lang eng') result = self.run_cli(f'"{self.sample_doc}" --ocr-lang eng')
assert result.exit_code == 0 assert result.exit_code == 0
@pytest.mark.parametrize(
"filename,",
[
"“Curly_Quotes”.pdf", # issue 144
"Оригинал.pdf",
],
)
def test_filenames(self, filename):
tempdir = tempfile.mkdtemp(prefix="dangerzone-")
doc_path = os.path.join(filename)
shutil.copyfile(self.sample_doc, doc_path)
result = self.run_cli(doc_path)
shutil.rmtree(tempdir)
assert result.exit_code == 0