From 8775255d7b639a50f452a7d6ec936175dc6509ff Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Mon, 5 Mar 2012 19:32:18 +0100 Subject: [PATCH] split tests for property access inspection --- .../overrideAssignment.py | 24 +++++++++++++++++ .../PyPropertyAccessInspection/test.py | 26 ------------------- .../jetbrains/python/PythonAllTestsSuite.java | 1 + .../python/PythonInspectionsTest.java | 5 ---- .../PyPropertyAccessInspectionTest.java | 24 +++++++++++++++++ 5 files changed, 49 insertions(+), 31 deletions(-) create mode 100644 python/testData/inspections/PyPropertyAccessInspection/overrideAssignment.py create mode 100644 python/testSrc/com/jetbrains/python/inspections/PyPropertyAccessInspectionTest.java diff --git a/python/testData/inspections/PyPropertyAccessInspection/overrideAssignment.py b/python/testData/inspections/PyPropertyAccessInspection/overrideAssignment.py new file mode 100644 index 000000000000..0c76e15800e3 --- /dev/null +++ b/python/testData/inspections/PyPropertyAccessInspection/overrideAssignment.py @@ -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 + self.bar = x + self.baz = x diff --git a/python/testData/inspections/PyPropertyAccessInspection/test.py b/python/testData/inspections/PyPropertyAccessInspection/test.py index c42ddcd4b3e3..a42b78fb6446 100644 --- a/python/testData/inspections/PyPropertyAccessInspection/test.py +++ b/python/testData/inspections/PyPropertyAccessInspection/test.py @@ -38,29 +38,3 @@ del a.readwriteself.bar = x - self.baz = x diff --git a/python/testSrc/com/jetbrains/python/PythonAllTestsSuite.java b/python/testSrc/com/jetbrains/python/PythonAllTestsSuite.java index c63805d4e4c6..d65d40a40266 100644 --- a/python/testSrc/com/jetbrains/python/PythonAllTestsSuite.java +++ b/python/testSrc/com/jetbrains/python/PythonAllTestsSuite.java @@ -91,6 +91,7 @@ public class PythonAllTestsSuite { PythonHighlightingLexerTest.class, PyOldStyleClassInspectionTest.class, PyMissingConstructorTest.class, + PyPropertyAccessInspectionTest.class, Jinja2ParserTest.class, DjangoTemplateParserTest.class }; diff --git a/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java b/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java index dc1556edd2fa..0ca723e1ffdc 100644 --- a/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java +++ b/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java @@ -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); } diff --git a/python/testSrc/com/jetbrains/python/inspections/PyPropertyAccessInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyPropertyAccessInspectionTest.java new file mode 100644 index 000000000000..a399b91ae9e7 --- /dev/null +++ b/python/testSrc/com/jetbrains/python/inspections/PyPropertyAccessInspectionTest.java @@ -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); + } +}