diff --git a/python/testData/inspections/PyCallingNonCallableInspection/classAsCallable.py b/python/testData/inspections/PyCallingNonCallableInspection/classAsCallable.py
new file mode 100644
index 000000000000..32ba6becf734
--- /dev/null
+++ b/python/testData/inspections/PyCallingNonCallableInspection/classAsCallable.py
@@ -0,0 +1,18 @@
+# PY-4061
+def test_class_as_callable():
+ class C1(object):
+ def __init__(self):
+ pass
+ def f(self):
+ pass
+ class C2(object):
+ def g(self):
+ pass
+ class C3:
+ pass
+ c1 = C1() #pass
+ c2 = C2() #pass
+ c3 = C3() #pass
+ c1.__class__().f() #pass
+ c2.__class__().g() #pass
+ c3.__class__() #pass
diff --git a/python/testData/inspections/PyCallingNonCallableInspection/classAssignments.py b/python/testData/inspections/PyCallingNonCallableInspection/classAssignments.py
new file mode 100644
index 000000000000..eba7d5f13aaa
--- /dev/null
+++ b/python/testData/inspections/PyCallingNonCallableInspection/classAssignments.py
@@ -0,0 +1,11 @@
+# PY-4061
+def test_class_assignments():
+ class C():
+ def __init__(self):
+ pass
+ d = C
+ a = d() #pass
+ l = list
+ a = l([]) #pass
+ d = dict
+ b = d({}) #pass
diff --git a/python/testData/inspections/PyCallingNonCallableInspection/concealer.py b/python/testData/inspections/PyCallingNonCallableInspection/concealer.py
new file mode 100644
index 000000000000..a55c71e60f3b
--- /dev/null
+++ b/python/testData/inspections/PyCallingNonCallableInspection/concealer.py
@@ -0,0 +1,6 @@
+def concealer():
+ class prog(object):
+ def __call__(self): pass
+
+ pr = prog()
+ pr()
diff --git a/python/testData/inspections/PyCallingNonCallableInspection/module.py b/python/testData/inspections/PyCallingNonCallableInspection/module.py
new file mode 100644
index 000000000000..c8c6768b72d7
--- /dev/null
+++ b/python/testData/inspections/PyCallingNonCallableInspection/module.py
@@ -0,0 +1,3 @@
+def test_module():
+ import sys
+ sys()
diff --git a/python/testData/inspections/PyCallingNonCallableInspection/staticMeth.py b/python/testData/inspections/PyCallingNonCallableInspection/staticMeth.py
new file mode 100644
index 000000000000..d9ee2699577b
--- /dev/null
+++ b/python/testData/inspections/PyCallingNonCallableInspection/staticMeth.py
@@ -0,0 +1,6 @@
+class SM(object):
+ def my_method(): pass
+ my_method = staticmethod(my_method)
+
+ def q(self):
+ self.my_method()
diff --git a/python/testData/inspections/PyCallingNonCallableInspection/test.py b/python/testData/inspections/PyCallingNonCallableInspection/test.py
deleted file mode 100644
index 667e1c015b80..000000000000
--- a/python/testData/inspections/PyCallingNonCallableInspection/test.py
+++ /dev/null
@@ -1,50 +0,0 @@
-(1,2)()
-
-class SM(object):
- def my_method(): pass
- my_method = staticmethod(my_method)
-
- def q(self):
- self.my_method()
-
-def concealer():
- class prog(object):
- def __call__(self): pass
-
- pr = prog()
- pr()
-
-def test_module():
- import sys
- sys()
-
-# PY-4061
-def test_class_as_callable():
- class C1(object):
- def __init__(self):
- pass
- def f(self):
- pass
- class C2(object):
- def g(self):
- pass
- class C3:
- pass
- c1 = C1() #pass
- c2 = C2() #pass
- c3 = C3() #pass
- c1.__class__().f() #pass
- c2.__class__().g() #pass
- c3.__class__() #pass
-
-# PY-4061
-def test_class_assignments():
- class C():
- def __init__(self):
- pass
- d = C
- a = d() #pass
- l = list
- a = l([]) #pass
- d = dict
- b = d({}) #pass
diff --git a/python/testData/inspections/PyCallingNonCallableInspection/tupleNonCallable.py b/python/testData/inspections/PyCallingNonCallableInspection/tupleNonCallable.py
new file mode 100644
index 000000000000..53b97c0f6326
--- /dev/null
+++ b/python/testData/inspections/PyCallingNonCallableInspection/tupleNonCallable.py
@@ -0,0 +1 @@
+(1,2)()
diff --git a/python/testSrc/com/jetbrains/python/PythonAllTestsSuite.java b/python/testSrc/com/jetbrains/python/PythonAllTestsSuite.java
index 9c09374111ce..646438997909 100644
--- a/python/testSrc/com/jetbrains/python/PythonAllTestsSuite.java
+++ b/python/testSrc/com/jetbrains/python/PythonAllTestsSuite.java
@@ -1,10 +1,7 @@
package com.jetbrains.python;
import com.jetbrains.python.codeInsight.PyCompletionPatternsTest;
-import com.jetbrains.python.inspections.PyArgumentListInspectionTest;
-import com.jetbrains.python.inspections.PyCompatibilityInspectionTest;
-import com.jetbrains.python.inspections.PyUnresolvedReferencesInspectionTest;
-import com.jetbrains.python.inspections.PyUnusedImportTest;
+import com.jetbrains.python.inspections.*;
import com.jetbrains.python.refactoring.*;
import com.jetbrains.python.refactoring.classes.PyExtractSuperclassTest;
import com.jetbrains.python.refactoring.classes.PyPullUpTest;
@@ -80,6 +77,7 @@ public class PythonAllTestsSuite {
PyCompletionPatternsTest.class,
PyCompatibilityInspectionTest.class,
PyUnresolvedReferencesInspectionTest.class,
+ PyCallingNonCallableTest.class,
PyUnusedImportTest.class,
PyDeprecationTest.class,
PythonHighlightingLexerTest.class
diff --git a/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java b/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java
index e87589ea3621..c3ec2f09b0c2 100644
--- a/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java
+++ b/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java
@@ -233,10 +233,6 @@ public class PythonInspectionsTest extends PyLightFixtureTestCase {
doHighlightingTest(PyCallByClassInspection.class); // ok, we can handle insanely long lines :)
}
- public void testPyCallingNonCallableInspection() {
- doHighlightingTest(PyCallingNonCallableInspection.class, LanguageLevel.PYTHON26);
- }
-
private void doHighlightingTest(final Class extends PyInspection> inspectionClass) {
myFixture.configureByFile("inspections/" + getTestName(false) + "/test.py");
myFixture.enableInspections(inspectionClass);
diff --git a/python/testSrc/com/jetbrains/python/inspections/PyCallingNonCallableTest.java b/python/testSrc/com/jetbrains/python/inspections/PyCallingNonCallableTest.java
new file mode 100644
index 000000000000..11f83a71988e
--- /dev/null
+++ b/python/testSrc/com/jetbrains/python/inspections/PyCallingNonCallableTest.java
@@ -0,0 +1,45 @@
+package com.jetbrains.python.inspections;
+
+import com.jetbrains.python.fixtures.PyLightFixtureTestCase;
+import com.jetbrains.python.psi.LanguageLevel;
+
+/**
+ * @author yole
+ */
+public class PyCallingNonCallableTest extends PyLightFixtureTestCase {
+ public void testTupleNonCallable() {
+ doTest();
+ }
+
+ public void testStaticMeth() {
+ doTest();
+ }
+
+ public void testConcealer() {
+ doTest();
+ }
+
+ public void testModule() {
+ doTest();
+ }
+
+ public void testClassAsCallable() { // PY-4061
+ doTest();
+ }
+
+ public void testClassAssignments() { // PY-4061
+ doTest();
+ }
+
+ private void doTest() {
+ setLanguageLevel(LanguageLevel.PYTHON26);
+ try {
+ myFixture.configureByFile("inspections/PyCallingNonCallableInspection/" + getTestName(true) + ".py");
+ myFixture.enableInspections(PyCallingNonCallableInspection.class);
+ myFixture.checkHighlighting(true, false, false);
+ }
+ finally {
+ setLanguageLevel(null);
+ }
+ }
+}