split PyUnresolvedReferencesInspection test into individual testcases

This commit is contained in:
Dmitry Jemerov
2011-05-24 17:13:49 +04:00
parent 02827c55fe
commit 18e4a232ce
10 changed files with 64 additions and 28 deletions
@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<problem>
<file>testcase.py</file>
<line>2</line>
<description>Unresolved reference 'testcase'</description>
</problem>
<problem>
<file>testcase.py</file>
<line>4</line>
<description>Unresolved reference 'wurm'</description>
</problem>
<problem>
<file>testcase.py</file>
<line>30</line>
<description>'B' object has no attribute 'bar'</description>
</problem>
<problem>
<file>testcase.py</file>
<line>36</line>
<description>'C' object has no attribute 'bar'</description>
</problem>
</problems>
@@ -0,0 +1,5 @@
class B:
def __getattr__(self, name):
pass
B().foo()
@@ -0,0 +1 @@
<warning descr="Unresolved reference 'selfReference'">selfReference</warning>
@@ -0,0 +1,11 @@
class B(object):
__slots__ = ['foo']
b = B()
<warning descr="'B' object has no attribute 'bar'">b.bar</warning> = 1
class C(B):
pass
c = C()
<warning descr="'C' object has no attribute 'bar'">c.bar</warning> = 1
@@ -0,0 +1,4 @@
class A:
@staticmethod
def foo(q):
q.bar()
@@ -0,0 +1,2 @@
x = object()
x.y = 5
@@ -0,0 +1 @@
import <warning descr="Unresolved reference 'wurm'">wurm</warning>
@@ -3,6 +3,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.refactoring.*;
import com.jetbrains.python.refactoring.classes.PyExtractSuperclassTest;
@@ -78,6 +79,7 @@ public class PythonAllTestsSuite {
PyBinaryModuleCompletionTest.class,
PyCompletionPatternsTest.class,
PyCompatibilityInspectionTest.class,
PyUnresolvedReferencesInspectionTest.class,
PyUnusedImportTest.class
};
@@ -47,11 +47,6 @@ public class PythonInspectionsTest extends PyLightFixtureTestCase {
doTest(getTestName(false), inspection);
}
public void testPyUnresolvedReferencesInspection() {
LocalInspectionTool inspection = new PyUnresolvedReferencesInspection();
doTest(getTestName(false), inspection);
}
public void testPyArgumentListInspection() {
LocalInspectionTool inspection = new PyArgumentListInspection();
doTest(getTestName(false), inspection);
@@ -0,0 +1,38 @@
package com.jetbrains.python.inspections;
import com.jetbrains.python.fixtures.PyLightFixtureTestCase;
/**
* @author yole
*/
public class PyUnresolvedReferencesInspectionTest extends PyLightFixtureTestCase {
public void testSelfReference() {
doTest();
}
public void testUnresolvedImport() {
doTest();
}
public void testStaticMethodParameter() { // PY-663
doTest();
}
public void testOverridesGetAttr() { // PY-574
doTest();
}
public void testUndeclaredAttrAssign() { // PY-906
doTest();
}
public void testSlots() {
doTest();
}
private void doTest() {
myFixture.configureByFile("inspections/PyUnresolvedReferencesInspection/" + getTestName(true) + ".py");
myFixture.enableInspections(PyUnresolvedReferencesInspection.class);
myFixture.checkHighlighting(true, false, false);
}
}