Mercurial > babel > mirror
comparison babel/messages/tests/pofile.py @ 442:af7b13202b11 trunk
Fix testcase name typo.
Switch to use a locale that uses a different singular and plural form instead
of just one form for both singular and plural.
author | jruigrok |
---|---|
date | Fri, 19 Feb 2010 13:16:08 +0000 |
parents | 942afedbb3d7 |
children | 53fe6880791a |
comparison
equal
deleted
inserted
replaced
441:942afedbb3d7 | 442:af7b13202b11 |
---|---|
188 # And verify it pass through write_po | 188 # And verify it pass through write_po |
189 out_buf = StringIO() | 189 out_buf = StringIO() |
190 pofile.write_po(out_buf, catalog, omit_header=True) | 190 pofile.write_po(out_buf, catalog, omit_header=True) |
191 assert out_buf.getvalue().strip() == buf.getvalue().strip(), out_buf.getvalue() | 191 assert out_buf.getvalue().strip() == buf.getvalue().strip(), out_buf.getvalue() |
192 | 192 |
193 def test_singlular_plural_form(self): | 193 def test_singular_plural_form(self): |
194 buf = StringIO(r'''msgid "foo" | 194 buf = StringIO(r'''msgid "foo" |
195 msgid_plural "foo" | 195 msgid_plural "foo" |
196 msgstr[0] "Voh" | 196 msgstr[0] "Voh" |
197 msgstr[1] "Vohs"''') # This is a bad po, ja_JP only uses msgstr[0] | 197 msgstr[1] "Vohs"''') |
198 catalog = pofile.read_po(buf, locale='ja_JP') | 198 catalog = pofile.read_po(buf, locale='nl_NL') |
199 self.assertEqual(1, len(catalog)) | 199 self.assertEqual(1, len(catalog)) |
200 self.assertEqual(1, catalog.num_plurals) | 200 self.assertEqual(2, catalog.num_plurals) |
201 message = catalog['foo'] | 201 message = catalog['foo'] |
202 self.assertEqual(1, len(message.string)) | 202 self.assertEqual(2, len(message.string)) |
203 | 203 |
204 def test_plural_with_square_brackets(self): | 204 def test_plural_with_square_brackets(self): |
205 buf = StringIO(r'''msgid "foo" | 205 buf = StringIO(r'''msgid "foo" |
206 msgid_plural "foo" | 206 msgid_plural "foo" |
207 msgstr[0] "Voh [text]" | 207 msgstr[0] "Voh [text]" |