mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
split tests for property access inspection
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user