first parameter of @classmethod method is callable

This commit is contained in:
Dmitry Jemerov
2011-08-29 15:02:57 +02:00
parent d637fcef06
commit 752b7b562f
3 changed files with 11 additions and 0 deletions
@@ -52,6 +52,9 @@ public class PyCallingNonCallableInspection extends PyInspection {
PyType calleeType = myTypeEvalContext.getType(callee);
if (calleeType instanceof PyClassType) {
PyClassType classType = (PyClassType) calleeType;
if (classType.isDefinition()) {
return;
}
PyClass cls = classType.getPyClass();
if (isMethodType(node, classType)) {
return;
@@ -0,0 +1,4 @@
class C:
@classmethod
def foo(cls):
return cls()
@@ -35,6 +35,10 @@ public class PyCallingNonCallableTest extends PyLightFixtureTestCase {
doTest();
}
public void testClassMethodFirstParam() {
doTest();
}
private void doTest() {
setLanguageLevel(LanguageLevel.PYTHON27);
try {