diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-06-07 19:36:39 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-06-07 19:36:39 (GMT) |
commit | 93e51aac540f0dbd795e709a6fad0b9a62a5ae73 (patch) | |
tree | 0643e0ae6b8cca600bca2368a16fc765a4dfebfb /Lib | |
parent | 4807dd0490d9ea85feb3c9d1f33b7e2927f14326 (diff) | |
download | cpython-93e51aac540f0dbd795e709a6fad0b9a62a5ae73.zip cpython-93e51aac540f0dbd795e709a6fad0b9a62a5ae73.tar.gz cpython-93e51aac540f0dbd795e709a6fad0b9a62a5ae73.tar.bz2 |
allow the keyword else immediately after (no space) an integer (closes #21642)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_grammar.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index 86cc084..5f77c1d 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -75,6 +75,12 @@ class TokenTests(unittest.TestCase): x = .3e14 x = 3.1e4 + def test_float_exponent_tokenization(self): + # See issue 21642. + self.assertEqual(1 if 1else 0, 1) + self.assertEqual(1 if 0else 0, 0) + self.assertRaises(SyntaxError, eval, "0 if 1Else 0") + def testStringLiterals(self): x = ''; y = ""; self.assertTrue(len(x) == 0 and x == y) x = '\''; y = "'"; self.assertTrue(len(x) == 1 and x == y and ord(x) == 39) |