]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add a test with a non-ASCII name in a type comment
authorGuido van Rossum <guido@python.org>
Mon, 28 Jan 2019 19:28:34 +0000 (11:28 -0800)
committerGuido van Rossum <guido@python.org>
Mon, 28 Jan 2019 19:28:34 +0000 (11:28 -0800)
Lib/test/test_type_comments.py

index 6e766361669a4b538537dde611424b1e8af2a00a..3065ddca2d9ab2c4760cd4c4ae69c463cc0762fa 100644 (file)
@@ -26,6 +26,12 @@ def foo():  # type: () -> int
     return ''
 """
 
+nonasciidef = """\
+def foo():
+    # type: () -> àçčéñt
+    pass
+"""
+
 forstmt = """\
 for a in []:  # type: int
     pass
@@ -175,6 +181,10 @@ class TypeCommentTests(unittest.TestCase):
         with self.assertRaisesRegex(SyntaxError, "^Cannot have two type comments on def"):
             tree = self.parse(redundantdef)
 
+    def test_nonasciidef(self):
+        tree = self.parse(nonasciidef)
+        self.assertEqual(tree.body[0].type_comment, "() -> àçčéñt")
+
     def test_forstmt(self):
         tree = self.parse(forstmt)
         self.assertEqual(tree.body[0].type_comment, "int")