From 0f4e6e9156fc136420ba82f0fcc2ffdb29e0d020 Mon Sep 17 00:00:00 2001 From: deeplow Date: Tue, 13 Sep 2022 13:04:13 +0100 Subject: [PATCH] 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. --- tests/test_cli.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test_cli.py b/tests/test_cli.py index b663f23..3177b3e 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,5 +1,7 @@ from __future__ import annotations +import os +import shutil import tempfile import pytest @@ -68,3 +70,18 @@ class TestCliConversion(TestCliBasic): def test_lang_eng(self): result = self.run_cli(f'"{self.sample_doc}" --ocr-lang eng') 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