diff babel/messages/tests/catalog.py @ 427:52492583006a

Fuzzy matching regarding plurals should *NOT* be checked against `len(message.id)` because this is always 2, instead, it's should be checked against `catalog.num_plurals`.
author palgarvio
date Sat, 10 Jan 2009 22:42:01 +0000
parents d07989336794
children 08e2d18163d9
line wrap: on
line diff
--- a/babel/messages/tests/catalog.py
+++ b/babel/messages/tests/catalog.py
@@ -215,6 +215,19 @@
         cat.update(tmpl, no_fuzzy_matching=True)
         self.assertEqual(2, len(cat.obsolete))
 
+    def test_fuzzy_matching_regarding_plurals(self):
+        cat = catalog.Catalog()
+        cat.add(('foo', 'foh'), ('foo', 'foh'))
+        ru = copy.copy(cat)
+        ru.locale = 'ru_RU'
+        ru.update(cat)
+        self.assertEqual(True, ru['foo'].fuzzy)
+        ru = copy.copy(cat)
+        ru.locale = 'ru_RU'
+        ru['foo'].string = ('foh', 'fohh', 'fohhh')
+        ru.update(cat)
+        self.assertEqual(False, ru['foo'].fuzzy)
+
     def test_update_no_template_mutation(self):
         tmpl = catalog.Catalog()
         tmpl.add('foo')
Copyright (C) 2012-2017 Edgewall Software