From 03d185ca1b3218741ecefe599c56aea8c1db16d5 Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Tue, 3 Sep 2013 18:04:48 +0400 Subject: [PATCH] Refactored PyRedeclarationInspection tests --- .../PyRedeclarationInspection/expected.xml | 23 ---------- .../PyRedeclarationInspection/test.py | 43 +++++++++++++++++++ .../python/PythonInspectionsTest.java | 3 +- 3 files changed, 44 insertions(+), 25 deletions(-) delete mode 100644 python/testData/inspections/PyRedeclarationInspection/expected.xml create mode 100644 python/testData/inspections/PyRedeclarationInspection/test.py diff --git a/python/testData/inspections/PyRedeclarationInspection/expected.xml b/python/testData/inspections/PyRedeclarationInspection/expected.xml deleted file mode 100644 index 538b4a439a17..000000000000 --- a/python/testData/inspections/PyRedeclarationInspection/expected.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - dupes.py - 2 - Shadows a class with the same name defined above - - - dupes.py - 5 - Shadows a function with the same name defined above - - - dupes.py - 8 - Shadows a function with the same name defined above - - - dupes.py - 9 - Shadows a variable with the same name defined above - - diff --git a/python/testData/inspections/PyRedeclarationInspection/test.py b/python/testData/inspections/PyRedeclarationInspection/test.py new file mode 100644 index 000000000000..89ad3cc34274 --- /dev/null +++ b/python/testData/inspections/PyRedeclarationInspection/test.py @@ -0,0 +1,43 @@ +def test_class(): + class X: + pass + + class X: + pass + +def test_function(): + def foo(): + pass + + def foo(): + pass + + +# Top-level variable test +def TopLevelBoo(): + pass + + +TopLevelBoo = 1 +TopLevelBoo = 2 + + +class TopLevelBoo: + pass + + +def test_decorated_function(decorator): + def foo(): + pass + + @decorator + def foo(): + pass + + def foo(): + pass + + +def test_local_variable(): + x = 1 + x = 2 diff --git a/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java b/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java index ceda9ec399b4..2d2ca30c7e0e 100644 --- a/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java +++ b/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java @@ -53,8 +53,7 @@ public class PythonInspectionsTest extends PyTestCase { } public void testPyRedeclarationInspection() { - LocalInspectionTool inspection = new PyRedeclarationInspection(); - doTest(getTestName(false), inspection); + doHighlightingTest(PyRedeclarationInspection.class); } public void testPyStringFormatInspection() {