mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-05-04 12:41:50 +02:00
Fix typos in test_cli.py conditions
This commit is contained in:
parent
cd338ab5d8
commit
b7809579b4
1 changed files with 6 additions and 6 deletions
|
@ -40,8 +40,9 @@ class CliTestCase(TestCase):
|
||||||
for p in samples_dir.rglob("*")
|
for p in samples_dir.rglob("*")
|
||||||
if p.is_file() and not p.name.endswith(self.SAFE_SUFFIX)
|
if p.is_file() and not p.name.endswith(self.SAFE_SUFFIX)
|
||||||
]
|
]
|
||||||
|
print(f"{self.BASIC_SAMPLE} --output-filename {self.SAMPLE_DIRECTORY}/out/my-output.pdf")
|
||||||
if len(self.samples) < 10:
|
if len(self.samples) < 10:
|
||||||
raise RuntimeWarning(f"Only ${len(self.samples)} samples found.")
|
raise RuntimeWarning(f"Only {len(self.samples)} samples found.")
|
||||||
|
|
||||||
def invoke_runner(self, *args, **kwargs) -> Result:
|
def invoke_runner(self, *args, **kwargs) -> Result:
|
||||||
return self.runner.invoke(cli_main, *args, **kwargs)
|
return self.runner.invoke(cli_main, *args, **kwargs)
|
||||||
|
@ -77,7 +78,7 @@ class CliConversionTestCase(CliTestCase):
|
||||||
self.assertEqual(result.exit_code, 0)
|
self.assertEqual(result.exit_code, 0)
|
||||||
|
|
||||||
def test_output_filename(self):
|
def test_output_filename(self):
|
||||||
result = self.invoke_runner(f"{self.BASIC_SAMPLE} --output-filename ${self.SAMPLE_DIRECTORY}/out/my-output.pdf")
|
result = self.invoke_runner(f"{self.BASIC_SAMPLE} --output-filename {self.SAMPLE_DIRECTORY}/out/my-output.pdf")
|
||||||
self.assertEqual(result.exit_code, 0)
|
self.assertEqual(result.exit_code, 0)
|
||||||
|
|
||||||
def test_output_filename_new_dir(self):
|
def test_output_filename_new_dir(self):
|
||||||
|
@ -85,15 +86,14 @@ class CliConversionTestCase(CliTestCase):
|
||||||
self.assertEqual(result.exit_code, 0)
|
self.assertEqual(result.exit_code, 0)
|
||||||
|
|
||||||
def test_sample_not_found(self):
|
def test_sample_not_found(self):
|
||||||
with self.subTest():
|
result = self.invoke_runner("fake-directory/fake-file.pdf")
|
||||||
result = self.invoke_runner("fake-directory/fake-file.pdf")
|
self.assertEquals(result.exit_code, 1)
|
||||||
self.assertEquals(result.exit_code, 0)
|
|
||||||
|
|
||||||
def test_lang_mismatch(self):
|
def test_lang_mismatch(self):
|
||||||
"""Try to OCR sample.pdf (Lorem ipsum) as traditional Chinese characters."""
|
"""Try to OCR sample.pdf (Lorem ipsum) as traditional Chinese characters."""
|
||||||
# TODO how should we handle these cases?
|
# TODO how should we handle these cases?
|
||||||
with self.assertWarns(RuntimeWarning):
|
with self.assertWarns(RuntimeWarning):
|
||||||
self.invoke_runner(f"${self.BASIC_SAMPLE} --ocr-lang chi_tra")
|
self.invoke_runner(f"{self.BASIC_SAMPLE} --ocr-lang chi_tra")
|
||||||
|
|
||||||
def test_lang_eng(self):
|
def test_lang_eng(self):
|
||||||
# Rewrite this case if samples in other languages or scripts are added.
|
# Rewrite this case if samples in other languages or scripts are added.
|
||||||
|
|
Loading…
Reference in a new issue