Refactored PyRedeclarationInspection tests

This commit is contained in:
Andrey Vlasovskikh
2013-09-03 18:04:48 +04:00
parent d55e3c08be
commit 03d185ca1b
3 changed files with 44 additions and 25 deletions
@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<problem>
<file>dupes.py</file>
<line>2</line>
<description>Shadows a class with the same name defined above</description>
</problem>
<problem>
<file>dupes.py</file>
<line>5</line>
<description>Shadows a function with the same name defined above</description>
</problem>
<problem>
<file>dupes.py</file>
<line>8</line>
<description>Shadows a function with the same name defined above</description>
</problem>
<problem>
<file>dupes.py</file>
<line>9</line>
<description>Shadows a variable with the same name defined above</description>
</problem>
</problems>
@@ -0,0 +1,43 @@
def test_class():
class X:
pass
class <warning descr="Shadows a class with the same name defined above">X</warning>:
pass
def test_function():
def foo():
pass
def <warning descr="Shadows a function with the same name defined above">foo</warning>():
pass
# Top-level variable test
def TopLevelBoo():
pass
<warning descr="Shadows a function with the same name defined above">TopLevelBoo</warning> = 1
<warning descr="Shadows a variable with the same name defined above">TopLevelBoo</warning> = 2
class <warning descr="Shadows a variable with the same name defined above">TopLevelBoo</warning>:
pass
def test_decorated_function(decorator):
def foo():
pass
@decorator
def foo():
pass
def <warning descr="Shadows a function with the same name defined above">foo</warning>():
pass
def test_local_variable():
x = 1
x = 2
@@ -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() {