Replace fileinput with regular open-replace
fileinput is supposed to save time in these cases but it's not capable of doing both in-place rewrites and working with a non-ascii encoding. This was not noticed until characters outside of ASCII were picked up by tesseract and saved in a HOCR file. Rework some surrounding code as well and add multilingual test cases.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -293,3 +293,15 @@ def test_blank_input_pdf():
|
||||
'blank.pdf', 'still_blank.pdf')
|
||||
assert p.returncode == ExitCode.ok
|
||||
|
||||
|
||||
def test_french():
|
||||
p, out, err = run_ocrmypdf_env(
|
||||
'français.pdf', 'français.pdf', '-l', 'fra')
|
||||
assert p.returncode == ExitCode.ok, \
|
||||
"This test may fail if Tesseract language packs are missing"
|
||||
|
||||
|
||||
def test_klingon():
|
||||
p, out, err = run_ocrmypdf_env(
|
||||
'français.pdf', 'français.pdf', '-l', 'klz')
|
||||
assert p.returncode == ExitCode.bad_args
|
||||
|
||||
Reference in New Issue
Block a user