mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
Collapsing excess whitespace after OCR
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from django.test import TestCase
|
||||
|
||||
from ..consumer import strip_excess_whitespace
|
||||
from ..models import FileInfo
|
||||
|
||||
|
||||
@@ -301,3 +302,16 @@ class Permutations(TestCase):
|
||||
}
|
||||
self._test_guessed_attributes(
|
||||
template.format(**spec), **spec)
|
||||
|
||||
|
||||
class TestOCR(TestCase):
|
||||
text_cases = [
|
||||
("simple string", "simple string"),
|
||||
("simple newline\n testing string", "simple newline\ntesting string"),
|
||||
("utf-8 строка с пробелами в конце ", "utf-8 строка с пробелами в конце")
|
||||
]
|
||||
|
||||
def test_strip_excess_whitespace(self):
|
||||
for source, result in self.text_cases:
|
||||
actual_result = strip_excess_whitespace(source)
|
||||
assert result == actual_result, "strip_exceess_whitespace(%s) != '%s', but '%s'" % (source, result, actual_result)
|
||||
|
Reference in New Issue
Block a user