Raise violation on starred expressions where the child is a boolean/none

This commit is contained in:
Batuhan Taskaya
2020-05-22 19:52:22 +03:00
parent 00621977b7
commit 8f46481aaf
3 changed files with 49 additions and 20 deletions

View File

@@ -339,3 +339,26 @@ def test_continue_in_finally():
assert _get_error_list(code, version="3.7")
@pytest.mark.parametrize(
'template', [
"a, b, {target}, c = d",
"a, b, *{target}, c = d",
"(a, *{target}), c = d",
"for x, {target} in y: pass",
"for x, q, {target} in y: pass",
"for x, q, *{target} in y: pass",
"for (x, *{target}), q in y: pass",
]
)
@pytest.mark.parametrize(
'target', [
"True",
"False",
"None",
"__debug__"
]
)
def test_forbidden_name(template, target):
assert _get_error_list(template.format(target=target), version="3")[0].message