bpo-29706: Test that IDLE colors async/await as keywords. (GH-6846)

Added to the eye-verified htest, not to the unittests.
Also remove some stray leftover comments.
(cherry picked from commit 389a48ede9)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
Miss Islington (bot) 2018-05-15 12:57:13 -07:00 committed by GitHub
parent f4fdb619dd
commit 8717cfeb6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -17,8 +17,6 @@ def make_pat():
builtinlist = [str(name) for name in dir(builtins) builtinlist = [str(name) for name in dir(builtins)
if not name.startswith('_') and \ if not name.startswith('_') and \
name not in keyword.kwlist] name not in keyword.kwlist]
# self.file = open("file") :
# 1st 'file' colorized normal, 2nd as builtin, 3rd as string
builtin = r"([^.'\"\\#]\b|^)" + any("BUILTIN", builtinlist) + r"\b" builtin = r"([^.'\"\\#]\b|^)" + any("BUILTIN", builtinlist) + r"\b"
comment = any("COMMENT", [r"#[^\n]*"]) comment = any("COMMENT", [r"#[^\n]*"])
stringprefix = r"(?i:r|u|f|fr|rf|b|br|rb)?" stringprefix = r"(?i:r|u|f|fr|rf|b|br|rb)?"
@ -268,13 +266,14 @@ def _color_delegator(parent): # htest #
"else: float(None)\n" "else: float(None)\n"
"if iF + If + IF: 'keyword matching must respect case'\n" "if iF + If + IF: 'keyword matching must respect case'\n"
"if'': x or'' # valid string-keyword no-space combinations\n" "if'': x or'' # valid string-keyword no-space combinations\n"
"async def f(): await g()\n"
"# All valid prefixes for unicode and byte strings should be colored.\n" "# All valid prefixes for unicode and byte strings should be colored.\n"
"'x', '''x''', \"x\", \"\"\"x\"\"\"\n" "'x', '''x''', \"x\", \"\"\"x\"\"\"\n"
"r'x', u'x', R'x', U'x', f'x', F'x'\n" "r'x', u'x', R'x', U'x', f'x', F'x'\n"
"fr'x', Fr'x', fR'x', FR'x', rf'x', rF'x', Rf'x', RF'x'\n" "fr'x', Fr'x', fR'x', FR'x', rf'x', rF'x', Rf'x', RF'x'\n"
"b'x',B'x', br'x',Br'x',bR'x',BR'x', rb'x'.rB'x',Rb'x',RB'x'\n" "b'x',B'x', br'x',Br'x',bR'x',BR'x', rb'x'.rB'x',Rb'x',RB'x'\n"
"# Invalid combinations of legal characters should be half colored.\n" "# Invalid combinations of legal characters should be half colored.\n"
"ur'x', ru'x', uf'x', fu'x', UR'x', ufr'x', rfu'x', xf'x', fx'x'" "ur'x', ru'x', uf'x', fu'x', UR'x', ufr'x', rfu'x', xf'x', fx'x'\n"
) )
text = Text(top, background="white") text = Text(top, background="white")
text.pack(expand=1, fill="both") text.pack(expand=1, fill="both")