Mercurial > babel > old > mirror
comparison 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 |
comparison
equal
deleted
inserted
replaced
426:57ff0314026c | 427:52492583006a |
---|---|
212 cat.add('bar', 'Bahr') | 212 cat.add('bar', 'Bahr') |
213 tmpl = catalog.Catalog() | 213 tmpl = catalog.Catalog() |
214 tmpl.add('foo') | 214 tmpl.add('foo') |
215 cat.update(tmpl, no_fuzzy_matching=True) | 215 cat.update(tmpl, no_fuzzy_matching=True) |
216 self.assertEqual(2, len(cat.obsolete)) | 216 self.assertEqual(2, len(cat.obsolete)) |
217 | |
218 def test_fuzzy_matching_regarding_plurals(self): | |
219 cat = catalog.Catalog() | |
220 cat.add(('foo', 'foh'), ('foo', 'foh')) | |
221 ru = copy.copy(cat) | |
222 ru.locale = 'ru_RU' | |
223 ru.update(cat) | |
224 self.assertEqual(True, ru['foo'].fuzzy) | |
225 ru = copy.copy(cat) | |
226 ru.locale = 'ru_RU' | |
227 ru['foo'].string = ('foh', 'fohh', 'fohhh') | |
228 ru.update(cat) | |
229 self.assertEqual(False, ru['foo'].fuzzy) | |
217 | 230 |
218 def test_update_no_template_mutation(self): | 231 def test_update_no_template_mutation(self): |
219 tmpl = catalog.Catalog() | 232 tmpl = catalog.Catalog() |
220 tmpl.add('foo') | 233 tmpl.add('foo') |
221 cat1 = catalog.Catalog() | 234 cat1 = catalog.Catalog() |