Mercurial > babel > mirror
comparison babel/messages/tests/pofile.py @ 444:a4eb4ea8d6f9 trunk
Put the square brackets test after all the normal plural tests. It's more
logical.
author | jruigrok |
---|---|
date | Fri, 19 Feb 2010 13:45:25 +0000 |
parents | 53fe6880791a |
children | 766ddd5161c8 |
comparison
equal
deleted
inserted
replaced
443:53fe6880791a | 444:a4eb4ea8d6f9 |
---|---|
209 self.assertEqual(1, len(catalog)) | 209 self.assertEqual(1, len(catalog)) |
210 self.assertEqual(2, catalog.num_plurals) | 210 self.assertEqual(2, catalog.num_plurals) |
211 message = catalog['foo'] | 211 message = catalog['foo'] |
212 self.assertEqual(2, len(message.string)) | 212 self.assertEqual(2, len(message.string)) |
213 | 213 |
214 def test_plural_with_square_brackets(self): | |
215 buf = StringIO(r'''msgid "foo" | |
216 msgid_plural "foo" | |
217 msgstr[0] "Voh [text]" | |
218 msgstr[1] "Vohs [text]"''') | |
219 catalog = pofile.read_po(buf, locale='nb_NO') | |
220 self.assertEqual(1, len(catalog)) | |
221 self.assertEqual(2, catalog.num_plurals) | |
222 message = catalog['foo'] | |
223 self.assertEqual(2, len(message.string)) | |
224 | |
225 def test_more_than_two_plural_forms(self): | 214 def test_more_than_two_plural_forms(self): |
226 buf = StringIO(r'''msgid "foo" | 215 buf = StringIO(r'''msgid "foo" |
227 msgid_plural "foo" | 216 msgid_plural "foo" |
228 msgstr[0] "Voh" | 217 msgstr[0] "Voh" |
229 msgstr[1] "Vohs"''') # last translation form is missing | 218 msgstr[1] "Vohs"''') # last translation form is missing |
232 self.assertEqual(1, len(catalog)) | 221 self.assertEqual(1, len(catalog)) |
233 self.assertEqual(3, catalog.num_plurals) | 222 self.assertEqual(3, catalog.num_plurals) |
234 message = catalog['foo'] | 223 message = catalog['foo'] |
235 self.assertEqual(3, len(message.string)) | 224 self.assertEqual(3, len(message.string)) |
236 self.assertEqual('', message.string[2]) | 225 self.assertEqual('', message.string[2]) |
226 | |
227 def test_plural_with_square_brackets(self): | |
228 buf = StringIO(r'''msgid "foo" | |
229 msgid_plural "foo" | |
230 msgstr[0] "Voh [text]" | |
231 msgstr[1] "Vohs [text]"''') | |
232 catalog = pofile.read_po(buf, locale='nb_NO') | |
233 self.assertEqual(1, len(catalog)) | |
234 self.assertEqual(2, catalog.num_plurals) | |
235 message = catalog['foo'] | |
236 self.assertEqual(2, len(message.string)) | |
237 | 237 |
238 | 238 |
239 class WritePoTestCase(unittest.TestCase): | 239 class WritePoTestCase(unittest.TestCase): |
240 | 240 |
241 def test_join_locations(self): | 241 def test_join_locations(self): |