diff options
author | Anteru <bitbucket@ca.sh13.net> | 2019-04-30 15:47:45 +0000 |
---|---|---|
committer | Anteru <bitbucket@ca.sh13.net> | 2019-04-30 15:47:45 +0000 |
commit | 83e159f05ec8dae7d6e52140b23b363d4c3b18f2 (patch) | |
tree | 1fa06af4657f37b48cc798a662a0986fb004ba52 /tests/test_python.py | |
parent | 836d98cc163ea0dcb1b60ef1e536fdacb351d78a (diff) | |
parent | a0fc52727aaed41c8e09c87996de842117872afb (diff) | |
download | pygments-83e159f05ec8dae7d6e52140b23b363d4c3b18f2.tar.gz |
Merged in Praetonus/pygments-main/pony (pull request #627)
Add lexer for the Pony language
Diffstat (limited to 'tests/test_python.py')
-rw-r--r-- | tests/test_python.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/test_python.py b/tests/test_python.py index f5784cb1..6445022c 100644 --- a/tests/test_python.py +++ b/tests/test_python.py @@ -3,7 +3,7 @@ Python Tests ~~~~~~~~~~~~ - :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -111,3 +111,23 @@ class Python3Test(unittest.TestCase): (Token.Text, u'\n'), ] self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) + + def test_pep_515(self): + """ + Tests that the lexer can parse numeric literals with underscores + """ + fragments = ( + (Token.Literal.Number.Integer, u'1_000_000'), + (Token.Literal.Number.Float, u'1_000.000_001'), + (Token.Literal.Number.Float, u'1_000e1_000j'), + (Token.Literal.Number.Hex, u'0xCAFE_F00D'), + (Token.Literal.Number.Bin, u'0b_0011_1111_0100_1110'), + (Token.Literal.Number.Oct, u'0o_777_123'), + ) + + for token, fragment in fragments: + tokens = [ + (token, fragment), + (Token.Text, u'\n'), + ] + self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) |