split tests for property access inspection

This commit is contained in:
Dmitry Jemerov
2012-03-05 19:32:18 +01:00
parent 632b8571c1
commit 8775255d7b
5 changed files with 49 additions and 31 deletions
@@ -0,0 +1,24 @@
def test_property_override_assignment():
class B(object):
@property
def foo(self):
return 0
@property
def bar(self):
return -1
@property
def baz(self):
return -2
class C(B):
foo = 'foo'
def baz(self):
return 'baz'
def f(self, x):
self.foo = x
<warning descr="Property 'bar' cannot be set">self.bar</warning> = x
self.baz = x
@@ -38,29 +38,3 @@ del <warning descr="Property 'readwrite' cannot be deleted">a.readwrite</warning
del a.deletable
x += a.readonly #pass
#PY-2313
def test_property_override_assignment():
class B(object):
@property
def foo(self):
return 0
@property
def bar(self):
return -1
@property
def baz(self):
return -2
class C(B):
foo = 'foo'
def baz(self):
return 'baz'
def f(self, x):
self.foo = x
<warning descr="Property 'bar' cannot be set">self.bar</warning> = x
self.baz = x
@@ -91,6 +91,7 @@ public class PythonAllTestsSuite {
PythonHighlightingLexerTest.class,
PyOldStyleClassInspectionTest.class,
PyMissingConstructorTest.class,
PyPropertyAccessInspectionTest.class,
Jinja2ParserTest.class,
DjangoTemplateParserTest.class
};
@@ -245,11 +245,6 @@ public class PythonInspectionsTest extends PyTestCase {
myFixture.checkHighlighting(true, false, true);
}
public void testPyPropertyAccessInspection() {
setLanguageLevel(LanguageLevel.PYTHON26);
doHighlightingTest(PyPropertyAccessInspection.class);
}
public void testPyPropertyDefinitionInspection25() {
doTestWithLanguageLevel(getTestName(false), new PyPropertyDefinitionInspection(), LanguageLevel.PYTHON25);
}
@@ -0,0 +1,24 @@
package com.jetbrains.python.inspections;
import com.jetbrains.python.fixtures.PyTestCase;
import com.jetbrains.python.psi.LanguageLevel;
/**
* @author yole
*/
public class PyPropertyAccessInspectionTest extends PyTestCase {
public void testTest() {
doTest();
}
public void testOverrideAssignment() { // PY-2313
doTest();
}
private void doTest() {
setLanguageLevel(LanguageLevel.PYTHON26);
myFixture.configureByFile("inspections/PyPropertyAccessInspection/" + getTestName(true) + ".py");
myFixture.enableInspections(PyPropertyAccessInspection.class);
myFixture.checkHighlighting(true, false, false);
}
}