summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJean Abou Samra <jean@abou-samra.fr>2023-02-12 02:49:28 +0100
committerJean Abou Samra <jean@abou-samra.fr>2023-02-12 02:54:38 +0100
commitc8b7ac5b7ae1428aa6315abb6b90af0c03ab4e30 (patch)
treee1e47f90009b8e6c964bff95e3fc89bf74a60613 /tests
parent63bb71a5acd0d49a2ceee15098485bc34b0e8864 (diff)
downloadbabel-c8b7ac5b7ae1428aa6315abb6b90af0c03ab4e30.tar.gz
Turn off difflib "autojunk" heuristic in fuzzy matching
difflib has a heuristic that used to make fuzzy matching unreliable for >200char strings. See https://github.com/python/cpython/issues/90825 Fixes #969
Diffstat (limited to 'tests')
-rw-r--r--tests/messages/test_catalog.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/messages/test_catalog.py b/tests/messages/test_catalog.py
index c2e7aed..b9d72bc 100644
--- a/tests/messages/test_catalog.py
+++ b/tests/messages/test_catalog.py
@@ -209,6 +209,25 @@ class CatalogTestCase(unittest.TestCase):
assert cat['fooo'].string == 'Vohe'
assert cat['fooo'].fuzzy is True
+ def test_update_fuzzy_matching_long_string(self):
+ lipsum = "\
+Lorem Ipsum is simply dummy text of the printing and typesetting \
+industry. Lorem Ipsum has been the industry's standard dummy text ever \
+since the 1500s, when an unknown printer took a galley of type and \
+scrambled it to make a type specimen book. It has survived not only \
+five centuries, but also the leap into electronic typesetting, \
+remaining essentially unchanged. It was popularised in the 1960s with \
+the release of Letraset sheets containing Lorem Ipsum passages, and \
+more recently with desktop publishing software like Aldus PageMaker \
+including versions of Lorem Ipsum."
+ cat = catalog.Catalog()
+ cat.add("ZZZZZZ " + lipsum, "foo")
+ tmpl = catalog.Catalog()
+ tmpl.add(lipsum + " ZZZZZZ")
+ cat.update(tmpl)
+ assert cat[lipsum + " ZZZZZZ"].fuzzy is True
+ assert len(cat.obsolete) == 0
+
def test_update_without_fuzzy_matching(self):
cat = catalog.Catalog()
cat.add('fo', 'Voh')