diff --git a/python/testData/inspections/PyUnresolvedReferencesInspection/slots.py b/python/testData/inspections/PyUnresolvedReferencesInspection/slots.py deleted file mode 100644 index c78d89f06692..000000000000 --- a/python/testData/inspections/PyUnresolvedReferencesInspection/slots.py +++ /dev/null @@ -1,24 +0,0 @@ -class B(object): - __slots__ = ['foo'] - -b = B() -b.bar = 1 - -class C(B): - pass - -c = C() -c.bar = 1 - -def test_slots_with_dict(): - class C(object): - __slots__ = ['__local', '__name__', '__dict__'] - a = C() - a.foo = 1 #pass - -def test_attr_listed_in_slots(): - class C(object): - __slots__ = ['foo'] - - c = C() - c.foo \ No newline at end of file diff --git a/python/testData/inspections/PyUnresolvedReferencesInspection/slotsAndListedAttrAccess.py b/python/testData/inspections/PyUnresolvedReferencesInspection/slotsAndListedAttrAccess.py new file mode 100644 index 000000000000..bd61153c5cda --- /dev/null +++ b/python/testData/inspections/PyUnresolvedReferencesInspection/slotsAndListedAttrAccess.py @@ -0,0 +1,5 @@ +class C(object): + __slots__ = ['foo'] + +c = C() +c.foo \ No newline at end of file diff --git a/python/testData/inspections/PyUnresolvedReferencesInspection/slotsAndUnlistedAttrAssign.py b/python/testData/inspections/PyUnresolvedReferencesInspection/slotsAndUnlistedAttrAssign.py new file mode 100644 index 000000000000..c8a651b76174 --- /dev/null +++ b/python/testData/inspections/PyUnresolvedReferencesInspection/slotsAndUnlistedAttrAssign.py @@ -0,0 +1,5 @@ +class B(object): + __slots__ = ['foo'] + +b = B() +b.bar = 1 \ No newline at end of file diff --git a/python/testData/inspections/PyUnresolvedReferencesInspection/slotsSuperclass.py b/python/testData/inspections/PyUnresolvedReferencesInspection/slotsSuperclass.py new file mode 100644 index 000000000000..9ee0c1d62560 --- /dev/null +++ b/python/testData/inspections/PyUnresolvedReferencesInspection/slotsSuperclass.py @@ -0,0 +1,8 @@ +class B(object): + __slots__ = ['foo'] + +class C(B): + pass + +c = C() +c.bar = 1 \ No newline at end of file diff --git a/python/testData/inspections/PyUnresolvedReferencesInspection/slotsWithDict.py b/python/testData/inspections/PyUnresolvedReferencesInspection/slotsWithDict.py new file mode 100644 index 000000000000..1b3cfc2d3470 --- /dev/null +++ b/python/testData/inspections/PyUnresolvedReferencesInspection/slotsWithDict.py @@ -0,0 +1,5 @@ +class C(object): + __slots__ = ['__local', '__name__', '__dict__'] + +a = C() +a.foo = 1 #pass \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java index 6f005d54b439..83cc94f1bcf4 100644 --- a/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java @@ -53,7 +53,20 @@ public class PyUnresolvedReferencesInspectionTest extends PyInspectionTestCase { doTest(); } - public void testSlots() { + public void testSlotsAndUnlistedAttrAssign() { + doTest(); + } + + public void testSlotsSuperclass() { + doTest(); + } + + public void testSlotsWithDict() { + doTest(); + } + + // PY-10397 + public void testSlotsAndListedAttrAccess() { doTest(); }