From: Guido van Rossum Date: Mon, 28 Jan 2019 19:28:34 +0000 (-0800) Subject: Add a test with a non-ASCII name in a type comment X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0adc22d37b11879163706846f28ea65ee8314b6;p=thirdparty%2FPython%2Fcpython.git Add a test with a non-ASCII name in a type comment --- 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")