mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Refactored PyRedeclarationInspection tests
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user