Mercurial > babel > old > mirror
changeset 489:1112a03f4d74 stable
Merged revisions 484-489 via svnmerge from
http://svn.edgewall.org/repos/babel/trunk
........
r484 | jruigrok | 2010-02-19 14:16:08 +0100 (vr, 19 feb 2010) | 4 lines
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.
........
r485 | jruigrok | 2010-02-19 14:38:24 +0100 (vr, 19 feb 2010) | 2 lines
Add a test for a locale with one plural form.
........
r486 | jruigrok | 2010-02-19 14:45:25 +0100 (vr, 19 feb 2010) | 3 lines
Put the square brackets test after all the normal plural tests. It's more
logical.
........
r487 | jruigrok | 2010-02-19 15:12:41 +0100 (vr, 19 feb 2010) | 2 lines
More than two plural forms work nowadays. Adjust the test.
........
r488 | jruigrok | 2010-02-19 15:15:56 +0100 (vr, 19 feb 2010) | 2 lines
Actually make the msgid_plural be a plural as per typical use case.
........
r489 | jruigrok | 2010-02-24 13:27:32 +0100 (wo, 24 feb 2010) | 2 lines
Forgot to bump the copyright line.
........
author | jruigrok |
---|---|
date | Sun, 11 Apr 2010 09:09:11 +0000 |
parents | f39489017da8 |
children | 58bd100bb5ed |
files | 0.9.x/babel/messages/tests/pofile.py |
diffstat | 1 files changed, 19 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/0.9.x/babel/messages/tests/pofile.py +++ b/0.9.x/babel/messages/tests/pofile.py @@ -143,29 +143,39 @@ self.assertEqual(1, len(catalog)) self.assertEqual(0, len(catalog.obsolete)) - def test_singlular_plural_form(self): + def test_single_plural_form(self): buf = StringIO(r'''msgid "foo" -msgid_plural "foo" -msgstr[0] "Voh" -msgstr[1] "Vohs"''') # This is a bad po, ja_JP only uses msgstr[0] +msgid_plural "foos" +msgstr[0] "Voh"''') catalog = pofile.read_po(buf, locale='ja_JP') self.assertEqual(1, len(catalog)) self.assertEqual(1, catalog.num_plurals) message = catalog['foo'] self.assertEqual(1, len(message.string)) - + + def test_singular_plural_form(self): + buf = StringIO(r'''msgid "foo" +msgid_plural "foos" +msgstr[0] "Voh" +msgstr[1] "Vohs"''') + catalog = pofile.read_po(buf, locale='nl_NL') + self.assertEqual(1, len(catalog)) + self.assertEqual(2, catalog.num_plurals) + message = catalog['foo'] + self.assertEqual(2, len(message.string)) + def test_more_than_two_plural_forms(self): buf = StringIO(r'''msgid "foo" -msgid_plural "foo" +msgid_plural "foos" msgstr[0] "Voh" -msgstr[1] "Vohs"''') # last translation form is missing -#msgstr[2] "Vohss"''') +msgstr[1] "Vohs" +msgstr[2] "Vohss"''') catalog = pofile.read_po(buf, locale='lv_LV') self.assertEqual(1, len(catalog)) self.assertEqual(3, catalog.num_plurals) message = catalog['foo'] self.assertEqual(3, len(message.string)) - self.assertEqual('', message.string[2]) + self.assertEqual(u'Vohss', message.string[2]) def test_plural_with_square_brackets(self): buf = StringIO(r'''msgid "foo"