Fix test data for PyDunderSlotsInspection

This commit is contained in:
Semyon Proshev
2017-05-13 00:17:45 +03:00
committed by Semyon Proshev
parent ac37160291
commit aa3981954b
41 changed files with 84 additions and 68 deletions
@@ -0,0 +1,5 @@
class Base(object):
foo = 1
class Derived(Base):
__slots__ = 'foo'
@@ -0,0 +1,3 @@
class Foo(object):
__slots__ = <warning descr="'foo' in __slots__ conflicts with class variable">'foo'</warning>
foo = 1
@@ -0,0 +1,3 @@
class Foo(object):
__slots__ = [<warning descr="'foo' in __slots__ conflicts with class variable">'foo'</warning>]
foo = 1
@@ -0,0 +1,3 @@
class Foo(object):
__slots__ = (<warning descr="'foo' in __slots__ conflicts with class variable">'foo'</warning>)
foo = 1
@@ -0,0 +1,5 @@
class Base(object):
__slots__ = 'foo'
class Derived(Base):
foo = 1
@@ -0,0 +1,6 @@
class Base(object):
__slots__ = 'bar'
foo = 1
class Derived(Base):
__slots__ = 'foo'
@@ -0,0 +1,6 @@
class Base(object):
__slots__ = 'foo'
class Derived(Base):
__slots__ = 'bar'
foo = 1
@@ -1,62 +0,0 @@
# PY-20280: one slot in list
class Foo(object):
__slots__ = [<warning descr="'foo' in __slots__ conflicts with class variable">'foo'</warning>]
foo = 1
# PY-20280: one slot in tuple
class Foo(object):
__slots__ = (<warning descr="'foo' in __slots__ conflicts with class variable">'foo'</warning>)
foo = 1
# PY-20280: one slot
class Foo(object):
__slots__ = <warning descr="'foo' in __slots__ conflicts with class variable">'foo'</warning>
foo = 1
# PY-20280: two slots in list
class Foo(object):
__slots__ = [<warning descr="'foo' in __slots__ conflicts with class variable">'foo'</warning>, 'bar']
foo = 1
# PY-20280: two slots in tuple
class Foo(object):
__slots__ = (<warning descr="'foo' in __slots__ conflicts with class variable">'foo'</warning>, 'bar')
foo = 1
# PY-20280: slots in base and class variable in derived
class Base(object):
__slots__ = 'foo'
class Derived(Base):
foo = 1
# PY-20280: class variable in base and slots in derived
class Base(object):
foo = 1
class Derived(Base):
__slots__ = 'foo'
# PY-20280: slots in base and derived, class variable in derived
class Base(object):
__slots__ = 'foo'
class Derived(Base):
__slots__ = 'bar'
foo = 1
# PY-20280: slots in base and derived, class variable in base
class Base(object):
__slots__ = 'bar'
foo = 1
class Derived(Base):
__slots__ = 'foo'
@@ -0,0 +1,3 @@
class Foo(object):
__slots__ = [<warning descr="'foo' in __slots__ conflicts with class variable">'foo'</warning>, 'bar']
foo = 1
@@ -0,0 +1,3 @@
class Foo(object):
__slots__ = (<warning descr="'foo' in __slots__ conflicts with class variable">'foo'</warning>, 'bar')
foo = 1
@@ -333,10 +333,6 @@ public class PythonInspectionsTest extends PyTestCase {
doHighlightingTest(PyShadowingNamesInspection.class);
}
public void testPyDunderSlotsInspection() {
runWithLanguageLevel(LanguageLevel.PYTHON30, () -> doHighlightingTest(PyDunderSlotsInspection.class));
}
// PY-21645
public void testInspectionsDisabledInFunctionTypeComments() {
myFixture.enableInspections(PyIncorrectDocstringInspection.class);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -189,6 +189,51 @@ public class PyDunderSlotsInspectionTest extends PyTestCase {
doTestPy3();
}
// PY-20280
public void testSlotInListAndClassVar() {
doTestPy3();
}
// PY-20280
public void testSlotInTupleAndClassVar() {
doTestPy3();
}
// PY-20280
public void testSlotAndClassVar() {
doTestPy3();
}
// PY-20280
public void testTwoSlotsInListAndClassVar() {
doTestPy3();
}
// PY-20280
public void testTwoSlotsInTupleAndClassVar() {
doTestPy3();
}
// PY-20280
public void testSlotsInBaseAndClassVarInDerived() {
doTestPy3();
}
// PY-20280
public void testClassVarInBaseAndSlotsInDerived() {
doTestPy3();
}
// PY-20280
public void testSlotsInBaseAndDerivedClassVarInDerived() {
doTestPy3();
}
// PY-20280
public void testSlotsInBaseAndDerivedClassVarInBase() {
doTestPy3();
}
private void doTestPy2() {
runWithLanguageLevel(LanguageLevel.PYTHON26, this::doTestPy);
}
@@ -198,7 +243,7 @@ public class PyDunderSlotsInspectionTest extends PyTestCase {
}
private void doTestPy() {
final String path = "inspections/PyDunderSlotsInspectionTest/" + getTestName(true) + ".py";
final String path = "inspections/PyDunderSlotsInspection/" + getTestName(true) + ".py";
final VirtualFile file = myFixture.getTempDirFixture().getFile(path);
if (file != null) {