mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-23164 Fixed: unittest unresolved attribute reference in setUp inside with statement
Don't skip with-statement children while collecting target expressions inside function.
This commit is contained in:
@@ -1222,6 +1222,8 @@ public class PyClassImpl extends PyBaseElementImpl<PyClassStub> implements PyCla
|
||||
.map(PyWithItem::getTarget)
|
||||
.select(PyTargetExpression.class)
|
||||
.forEach(result::add);
|
||||
|
||||
super.visitPyWithStatement(node);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class Foo(object):
|
||||
def __init__(self):
|
||||
with open('b.py'):
|
||||
self.scope = "a"
|
||||
pass
|
||||
|
||||
def get_scope(self):
|
||||
return self.scope
|
||||
+5
@@ -758,6 +758,11 @@ public class PyUnresolvedReferencesInspectionTest extends PyInspectionTestCase {
|
||||
assertNotParsed((PyFile)fooPsiFile);
|
||||
}
|
||||
|
||||
// PY-23164
|
||||
public void testInstanceAttributeCreatedInsideWithStatement() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected Class<? extends PyInspection> getInspectionClass() {
|
||||
|
||||
Reference in New Issue
Block a user