summaryrefslogtreecommitdiff
path: root/Lib/test/test_tokenize.py
diff options
context:
space:
mode:
authorJim Fasarakis-Hilliard <d.f.hilliard@gmail.com>2017-03-14 22:16:15 +0200
committerStefan Krah <skrah@bytereef.org>2017-03-14 21:16:15 +0100
commitd4914e9041cb9455592facba2a1afa6d905f1c01 (patch)
treea079685cdebad7f9b8bb3ac5c84e7a0f15a3584b /Lib/test/test_tokenize.py
parent9135275cba680902e6caf29461f0423dc570190d (diff)
downloadcpython-git-d4914e9041cb9455592facba2a1afa6d905f1c01.tar.gz
Add ELLIPSIS and RARROW. Add tests (#666)
Diffstat (limited to 'Lib/test/test_tokenize.py')
-rw-r--r--Lib/test/test_tokenize.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py
index 5a81a5f11a..6b57777f61 100644
--- a/Lib/test/test_tokenize.py
+++ b/Lib/test/test_tokenize.py
@@ -408,6 +408,25 @@ def"', """\
OP ':' (1, 23) (1, 24)
NAME 'pass' (1, 25) (1, 29)
""")
+ self.check_tokenize("def d23(a: str, b: int=3) -> int: pass", """\
+ NAME 'def' (1, 0) (1, 3)
+ NAME 'd23' (1, 4) (1, 7)
+ OP '(' (1, 7) (1, 8)
+ NAME 'a' (1, 8) (1, 9)
+ OP ':' (1, 9) (1, 10)
+ NAME 'str' (1, 11) (1, 14)
+ OP ',' (1, 14) (1, 15)
+ NAME 'b' (1, 16) (1, 17)
+ OP ':' (1, 17) (1, 18)
+ NAME 'int' (1, 19) (1, 22)
+ OP '=' (1, 22) (1, 23)
+ NUMBER '3' (1, 23) (1, 24)
+ OP ')' (1, 24) (1, 25)
+ OP '->' (1, 26) (1, 28)
+ NAME 'int' (1, 29) (1, 32)
+ OP ':' (1, 32) (1, 33)
+ NAME 'pass' (1, 34) (1, 38)
+ """)
def test_comparison(self):
# Comparison
@@ -1371,6 +1390,8 @@ class TestTokenize(TestCase):
self.assertExactTypeEqual('**=', token.DOUBLESTAREQUAL)
self.assertExactTypeEqual('//', token.DOUBLESLASH)
self.assertExactTypeEqual('//=', token.DOUBLESLASHEQUAL)
+ self.assertExactTypeEqual('...', token.ELLIPSIS)
+ self.assertExactTypeEqual('->', token.RARROW)
self.assertExactTypeEqual('@', token.AT)
self.assertExactTypeEqual('@=', token.ATEQUAL)