Skip to content

Commit 389a48e

Browse files
authored
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.
1 parent 9eb40bc commit 389a48e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Lib/idlelib/colorizer.py

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

0 commit comments

Comments
 (0)