PY-17331 Consider "class" as reserved word in Python, not "__class__"

This commit is contained in:
Mikhail Golubev
2015-10-25 15:49:44 +03:00
parent 5c9cf02be6
commit 634be82fe9
3 changed files with 12 additions and 1 deletions
@@ -483,7 +483,7 @@ public class PyNames {
EXCEPT,
IMPORT,
PRINT,
__CLASS__,
CLASS,
EXEC,
IN,
RAISE,
@@ -0,0 +1,5 @@
class Class:
pass
Cl<caret>ass()
@@ -87,6 +87,12 @@ public class PyIntroduceVariableTest extends PyIntroduceTestCase {
assertDoesntContain(suggestions, "select");
}
// PY-17331
public void testDontSuggestReservedName() {
final Collection<String> suggestions = buildSuggestions(PyCallExpression.class);
assertDoesntContain(suggestions, "class");
}
public void testSuggestNamesNotInScope() { // PY-4605
final Collection<String> strings = buildSuggestions(PyExpression.class);
assertTrue(strings.contains("myfunc1"));