From d0adc22d37b11879163706846f28ea65ee8314b6 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 28 Jan 2019 11:28:34 -0800 Subject: [PATCH] Add a test with a non-ASCII name in a type comment --- Lib/test/test_type_comments.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Lib/test/test_type_comments.py b/Lib/test/test_type_comments.py index 6e766361669a..3065ddca2d9a 100644 --- a/Lib/test/test_type_comments.py +++ b/Lib/test/test_type_comments.py @@ -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") -- 2.47.3