bpo-28692: Deprecate using non-integer value for selecting a plural form in gettext. (#507)

This commit is contained in:
Serhiy Storchaka 2017-03-12 13:15:01 +02:00 committed by GitHub
parent 1989763f0d
commit f6595983e0
4 changed files with 17 additions and 3 deletions

View file

@ -443,9 +443,12 @@ class PluralFormsTestCase(GettextBaseTest):
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)
with self.assertWarns(DeprecationWarning):
self.assertEqual(f(1.0), 0)
with self.assertWarns(DeprecationWarning):
self.assertEqual(f(2.0), 1)
with self.assertWarns(DeprecationWarning):
self.assertEqual(f(1.1), 1)
self.assertRaises(TypeError, f, '2')
self.assertRaises(TypeError, f, b'2')
self.assertRaises(TypeError, f, [])