diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-14 19:30:36 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-14 19:30:36 +0200 |
commit | 39d2dfef447fbc957d75f2d3806a3a80c814a2d0 (patch) | |
tree | a0a4ad03a2c4e1bb0fe2cb07f3301e702561d6a3 /Lib/test/test_gettext.py | |
parent | 38c8b7d2922c20010930eedacdccf61fb2246761 (diff) | |
parent | 5ae6c776a8fc96df95597a9b24109c7448131276 (diff) | |
download | cpython-git-39d2dfef447fbc957d75f2d3806a3a80c814a2d0.tar.gz |
Issue #28563: Make plural form selection more lenient and accepting
non-integer numbers. Django tests depend on this.
Diffstat (limited to 'Lib/test/test_gettext.py')
-rw-r--r-- | Lib/test/test_gettext.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Lib/test/test_gettext.py b/Lib/test/test_gettext.py index 55bff4f243..a852443e68 100644 --- a/Lib/test/test_gettext.py +++ b/Lib/test/test_gettext.py @@ -440,12 +440,16 @@ class PluralFormsTestCase(GettextBaseTest): self.assertRaises(ZeroDivisionError, f, 0) def test_plural_number(self): - f = gettext.c2py('1') - self.assertEqual(f(1), 1) - self.assertRaises(ValueError, f, 1.0) - self.assertRaises(ValueError, f, '1') - self.assertRaises(ValueError, f, []) - self.assertRaises(ValueError, f, object()) + f = gettext.c2py('n != 1') + self.assertEqual(f(1), 0) + self.assertEqual(f(2), 1) + self.assertEqual(f(1.0), 0) + self.assertEqual(f(2.0), 1) + self.assertEqual(f(1.1), 1) + self.assertRaises(TypeError, f, '2') + self.assertRaises(TypeError, f, b'2') + self.assertRaises(TypeError, f, []) + self.assertRaises(TypeError, f, object()) class GNUTranslationParsingTest(GettextBaseTest): |