https://github.com/python/cpython/commit/1b2cfb73f95e11e91789ca771837b9906663446c commit: 1b2cfb73f95e11e91789ca771837b9906663446c branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: serhiy-storchaka <[email protected]> date: 2025-02-17T09:21:00Z summary:
[3.13] gh-130193: Increase test coverage of gettext.c2py (GH-130208) (GH-130217) (cherry picked from commit fb2d325725dcc881868b576b9d0d9f4bf7f24fe0) Co-authored-by: Tomas R <[email protected]> files: M Lib/test/test_gettext.py diff --git a/Lib/test/test_gettext.py b/Lib/test/test_gettext.py index dbbbdbcdaef05e..e0cd6a7e3cc4a6 100644 --- a/Lib/test/test_gettext.py +++ b/Lib/test/test_gettext.py @@ -567,12 +567,18 @@ def test_decimal_number(self): def test_invalid_syntax(self): invalid_expressions = [ 'x>1', '(n>1', 'n>1)', '42**42**42', '0xa', '1.0', '1e2', - 'n>0x1', '+n', '-n', 'n()', 'n(1)', '1+', 'nn', 'n n', + 'n>0x1', '+n', '-n', 'n()', 'n(1)', '1+', 'nn', 'n n', 'n ? 1 2' ] for expr in invalid_expressions: with self.assertRaises(ValueError): gettext.c2py(expr) + def test_negation(self): + f = gettext.c2py('!!!n') + self.assertEqual(f(0), 1) + self.assertEqual(f(1), 0) + self.assertEqual(f(2), 0) + def test_nested_condition_operator(self): self.assertEqual(gettext.c2py('n?1?2:3:4')(0), 4) self.assertEqual(gettext.c2py('n?1?2:3:4')(1), 2) _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: [email protected]
