summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMichael J. Sullivan <sully@msully.net>2019-05-22 14:54:20 (GMT)
committerIvan Levkivskyi <levkivskyi@gmail.com>2019-05-22 14:54:20 (GMT)
commit933e1509ec6efa8e6ab8c8c7ce02059ce2b6d9b9 (patch)
tree97980dec3873370773b481e2bc1f08f9f1624b9d /Lib
parent4c7a46eb3c009c85ddf2eb315d94d804745187d4 (diff)
downloadcpython-933e1509ec6efa8e6ab8c8c7ce02059ce2b6d9b9.zip
cpython-933e1509ec6efa8e6ab8c8c7ce02059ce2b6d9b9.tar.gz
cpython-933e1509ec6efa8e6ab8c8c7ce02059ce2b6d9b9.tar.bz2
bpo-36878: Track extra text added to 'type: ignore' in the AST (GH-13479)
GH-13238 made extra text after a # type: ignore accepted by the parser. This finishes the job and actually plumbs the extra text through the parser and makes it available in the AST.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_type_comments.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/Lib/test/test_type_comments.py b/Lib/test/test_type_comments.py
index b431890..c62894f 100644
--- a/Lib/test/test_type_comments.py
+++ b/Lib/test/test_type_comments.py
@@ -272,7 +272,16 @@ class TypeCommentTests(unittest.TestCase):
def test_ignores(self):
for tree in self.parse_all(ignores):
- self.assertEqual([ti.lineno for ti in tree.type_ignores], [2, 5, 8, 9, 10, 11])
+ self.assertEqual(
+ [(ti.lineno, ti.tag) for ti in tree.type_ignores],
+ [
+ (2, ''),
+ (5, ''),
+ (8, '[excuse]'),
+ (9, '=excuse'),
+ (10, ' [excuse]'),
+ (11, ' whatever'),
+ ])
tree = self.classic_parse(ignores)
self.assertEqual(tree.type_ignores, [])