]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Don't consider better OCR as failing 3783/head
authorDennis Brakhane <brakhane@gmail.com>
Tue, 11 Jul 2023 14:41:31 +0000 (16:41 +0200)
committerDennis Brakhane <brakhane@gmail.com>
Tue, 11 Jul 2023 14:44:18 +0000 (16:44 +0200)
Tesseract 5.3.0 does a better job at OCR, and correctly
reads "a webp" instead of "awebp", this is good, so we
don't want the test to fail.

src/paperless_tesseract/tests/test_parser.py

index 7850ad4ef848ce8714cfb5c8c13d4ac06561dbdb..8b3de5615c4a83011c41fcbfdf19bd84fe5dff7b 100644 (file)
@@ -861,8 +861,9 @@ class TestParserFileTypes(DirectoriesMixin, FileSystemAssertsMixin, TestCase):
         parser = RasterisedDocumentParser(None)
         parser.parse(os.path.join(self.SAMPLE_FILES, "document.webp"), "image/webp")
         self.assertIsFile(parser.archive_path)
-        # OCR consistent mangles this space, oh well
-        self.assertIn(
-            "this is awebp document, created 11/14/2022.",
+        # Older tesseracts consistently mangle the space between "a webp",
+        # tesseract 5.3.0 seems to do a better job, so we're accepting both
+        self.assertRegex(
             parser.get_text().lower(),
+            r"this is a ?webp document, created 11/14/2022.",
         )