diff --git a/python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java b/python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java index 65082a233281..711c08216d9f 100644 --- a/python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java +++ b/python/pydevSrc/com/jetbrains/python/debugger/pydev/RemoteDebugger.java @@ -36,6 +36,9 @@ public class RemoteDebugger implements ProcessDebugger { private static final SecureRandom ourRandom = new SecureRandom(); + + private static final int CONNECTION_TIMEOUT = 60000; + private final IPyDebugProcess myDebugProcess; private final ServerSocket myServerSocket; private final int myTimeout; @@ -71,6 +74,7 @@ public class RemoteDebugger implements ProcessDebugger { public void waitForConnect() throws Exception { try { //noinspection SocketOpenedButNotSafelyClosed + myServerSocket.setSoTimeout(CONNECTION_TIMEOUT); mySocket = myServerSocket.accept(); myConnected = true; } diff --git a/python/python-tests.iml b/python/python-tests.iml index 56cbdc0b8d85..ceff856a0060 100644 --- a/python/python-tests.iml +++ b/python/python-tests.iml @@ -24,6 +24,7 @@ + diff --git a/python/src/com/jetbrains/python/formatter/PyBlock.java b/python/src/com/jetbrains/python/formatter/PyBlock.java index 5f9cd0d0f834..5519949e3f4b 100644 --- a/python/src/com/jetbrains/python/formatter/PyBlock.java +++ b/python/src/com/jetbrains/python/formatter/PyBlock.java @@ -53,7 +53,8 @@ public class PyBlock implements ASTBlock { PyElementTypes.TUPLE_EXPRESSION, PyElementTypes.PARENTHESIZED_EXPRESSION, PyElementTypes.SLICE_EXPRESSION, - PyElementTypes.SUBSCRIPTION_EXPRESSION); + PyElementTypes.SUBSCRIPTION_EXPRESSION, + PyElementTypes.GENERATOR_EXPRESSION); private static final TokenSet ourBrackets = TokenSet.create(PyTokenTypes.LPAR, PyTokenTypes.RPAR, PyTokenTypes.LBRACE, PyTokenTypes.RBRACE, diff --git a/python/src/com/jetbrains/python/inspections/PyUnresolvedReferencesInspection.java b/python/src/com/jetbrains/python/inspections/PyUnresolvedReferencesInspection.java index 6e72ba6a4ef5..4fd8a4318a83 100644 --- a/python/src/com/jetbrains/python/inspections/PyUnresolvedReferencesInspection.java +++ b/python/src/com/jetbrains/python/inspections/PyUnresolvedReferencesInspection.java @@ -17,8 +17,6 @@ import com.intellij.psi.*; import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.Consumer; -import com.jetbrains.cython.CythonLanguageDialect; -import com.jetbrains.cython.CythonNames; import com.jetbrains.cython.psi.CythonFile; import com.jetbrains.cython.types.CythonBuiltinType; import com.jetbrains.cython.types.CythonType; @@ -423,12 +421,6 @@ public class PyUnresolvedReferencesInspection extends PyInspection { if (PyNames.COMPARISON_OPERATORS.contains(refname)) { return; } - if (CythonLanguageDialect.isInsideCythonFile(element) && - (CythonNames.BASE_C_TYPES.contains(text) || - CythonNames.BASE_CYTHON_TYPES.contains(text) || - CythonNames.BUILTINS.contains(text))) { - return; - } if (refex.getQualifier() != null) { final PyClassTypeImpl object_type = (PyClassTypeImpl)PyBuiltinCache.getInstance(node).getObjectType(); if ((object_type != null) && object_type.getPossibleInstanceMembers().contains(refname)) return; diff --git a/python/src/com/jetbrains/python/parsing/Parsing.java b/python/src/com/jetbrains/python/parsing/Parsing.java index 1eb7b1a8136f..de5c0b14f302 100644 --- a/python/src/com/jetbrains/python/parsing/Parsing.java +++ b/python/src/com/jetbrains/python/parsing/Parsing.java @@ -5,6 +5,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.psi.tree.IElementType; import com.jetbrains.python.PyElementTypes; import com.jetbrains.python.psi.PyElementType; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -53,6 +54,10 @@ public class Parsing { return myBuilder.getTokenType() == tokenType; } + protected boolean atToken(@NotNull final IElementType tokenType, @NotNull String tokenText) { + return myBuilder.getTokenType() == tokenType && tokenText.equals(myBuilder.getTokenText()); + } + protected boolean atAnyOfTokens(final IElementType... tokenTypes) { IElementType currentTokenType = myBuilder.getTokenType(); for (IElementType tokenType : tokenTypes) { diff --git a/python/src/com/jetbrains/python/psi/impl/PyPathEvaluator.java b/python/src/com/jetbrains/python/psi/impl/PyPathEvaluator.java index bb3e2257e688..ce8e00216acb 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyPathEvaluator.java +++ b/python/src/com/jetbrains/python/psi/impl/PyPathEvaluator.java @@ -43,7 +43,7 @@ public class PyPathEvaluator { return argValue == null ? null : new File(argValue).getParent(); } else if (call.isCalleeText(PyNames.JOIN) && args.length >= 1) { - return evaluatePathInJoin(containingFilePath, args, args.length); + return evaluatePathInJoin(containingFilePath, args, args.length, visited); } else if (call.isCalleeText(PyNames.ABSPATH) && args.length == 1) { String argValue = evaluate(args[0], containingFilePath, visited); @@ -97,10 +97,10 @@ public class PyPathEvaluator { return null; } - public static String evaluatePathInJoin(String containingFilePath, PyExpression[] args, int endElement) { + public static String evaluatePathInJoin(String containingFilePath, PyExpression[] args, int endElement, Set visited) { String result = null; for (int i = 0; i < endElement; i++) { - String arg = evaluate(args[i], containingFilePath, new HashSet()); + String arg = evaluate(args[i], containingFilePath, visited); if (arg == null) { return null; } diff --git a/python/src/com/jetbrains/python/psi/impl/PyReferenceExpressionImpl.java b/python/src/com/jetbrains/python/psi/impl/PyReferenceExpressionImpl.java index 4893d08920df..62c950ba96e9 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyReferenceExpressionImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyReferenceExpressionImpl.java @@ -10,6 +10,7 @@ import com.jetbrains.cython.CythonLanguageDialect; import com.jetbrains.cython.psi.CythonCImportElement; import com.jetbrains.cython.psi.CythonFromCImportStatement; import com.jetbrains.cython.psi.CythonImportReference; +import com.jetbrains.cython.psi.CythonReference; import com.jetbrains.python.PyNames; import com.jetbrains.python.PyTokenTypes; import com.jetbrains.python.PythonDialectsTokenSetProvider; @@ -55,7 +56,8 @@ public class PyReferenceExpressionImpl extends PyElementImpl implements PyRefere final PyExpression qualifier = getQualifier(); // Handle import reference - if (CythonLanguageDialect.isInsideCythonFile(this)) { + final boolean inCythonFile = CythonLanguageDialect.isInsideCythonFile(this); + if (inCythonFile) { if (PsiTreeUtil.getParentOfType(this, CythonCImportElement.class, CythonFromCImportStatement.class) != null) { return new CythonImportReference(this, context); } @@ -65,21 +67,23 @@ public class PyReferenceExpressionImpl extends PyElementImpl implements PyRefere return PyImportReference.forElement(this, importParent, context); } - if (file != null) { - // Return special reference - final ConsoleCommunication communication = file.getCopyableUserData(PydevConsoleRunner.CONSOLE_KEY); - if (communication != null) { - if (qualifier != null) { - return new PydevConsoleReference(this, communication, qualifier.getText() + "."); - } - return new PydevConsoleReference(this, communication, ""); + // Return special reference + final ConsoleCommunication communication = file.getCopyableUserData(PydevConsoleRunner.CONSOLE_KEY); + if (communication != null) { + if (qualifier != null) { + return new PydevConsoleReference(this, communication, qualifier.getText() + "."); } + return new PydevConsoleReference(this, communication, ""); } if (qualifier != null) { return new PyQualifiedReference(this, context); } + if (inCythonFile) { + return new CythonReference(this, context); + } + return new PyReferenceImpl(this, context); } diff --git a/python/src/com/jetbrains/python/remote/PythonRemoteInterpreterManager.java b/python/src/com/jetbrains/python/remote/PythonRemoteInterpreterManager.java index a10ad75c16a6..b2f2f6cf5ba7 100644 --- a/python/src/com/jetbrains/python/remote/PythonRemoteInterpreterManager.java +++ b/python/src/com/jetbrains/python/remote/PythonRemoteInterpreterManager.java @@ -11,10 +11,7 @@ import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.projectRoots.SdkModificator; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.remotesdk.RemoteCredentials; -import com.intellij.remotesdk.RemoteInterpreterException; -import com.intellij.remotesdk.RemoteSdkData; -import com.intellij.remotesdk.RemoteSshProcess; +import com.intellij.remotesdk.*; import com.intellij.util.NullableConsumer; import com.intellij.util.PathMappingSettings; import com.jetbrains.python.PythonHelpersLocator; @@ -30,7 +27,7 @@ import java.util.List; /** * @author traff */ -public abstract class PythonRemoteInterpreterManager { +public abstract class PythonRemoteInterpreterManager implements RemoteSdkFactory { public final static ExtensionPointName EP_NAME = ExtensionPointName.create("Pythonid.remoteInterpreterManager"); public static final String WEB_DEPLOYMENT_PLUGIN_IS_DISABLED = diff --git a/python/src/com/jetbrains/python/validation/Pep8ExternalAnnotator.java b/python/src/com/jetbrains/python/validation/Pep8ExternalAnnotator.java index 98fd2eb652e3..136b9f76efdb 100644 --- a/python/src/com/jetbrains/python/validation/Pep8ExternalAnnotator.java +++ b/python/src/com/jetbrains/python/validation/Pep8ExternalAnnotator.java @@ -143,13 +143,7 @@ public class Pep8ExternalAnnotator extends ExternalAnnotatora) #fail + a = 21 + print(a) #pass + + +foo() +print(a) + +if bla_bla(): #pass + b = 1 +print(b) #fail +print(b) #pass +c = 1 + +def buzz(): + print(c) #pass + +buzz() + +print BLA_BLA_BLA #pass + +if foo(): + d = 1 +else: + d = 2 + +print(d) #pass diff --git a/python/testData/inspections/PyUnboundLocalVariableInspection/StarImportTopLevel.py b/python/testData/inspections/PyUnboundLocalVariableInspection/StarImportTopLevel.py new file mode 100644 index 000000000000..2def04cfae38 --- /dev/null +++ b/python/testData/inspections/PyUnboundLocalVariableInspection/StarImportTopLevel.py @@ -0,0 +1,2 @@ +from re import * +print(UNICODE) diff --git a/python/testData/inspections/PyUnboundLocalVariableInspection/SysExit.py b/python/testData/inspections/PyUnboundLocalVariableInspection/SysExit.py new file mode 100644 index 000000000000..36513e13a8b1 --- /dev/null +++ b/python/testData/inspections/PyUnboundLocalVariableInspection/SysExit.py @@ -0,0 +1,3 @@ +def f(): + import sys + sys.exit(1) #pass diff --git a/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundAugmentedAssignment.py b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundAugmentedAssignment.py new file mode 100644 index 000000000000..539cc26f7ee6 --- /dev/null +++ b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundAugmentedAssignment.py @@ -0,0 +1,5 @@ +def f(c): + if c: + x = 1 + x += 1 #fail + return x diff --git a/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundConditionalImport.py b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundConditionalImport.py new file mode 100644 index 000000000000..978e0861ab60 --- /dev/null +++ b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundConditionalImport.py @@ -0,0 +1,4 @@ +def f(c): + if c: + import sys + return sys diff --git a/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundConditionalImportAlias.py b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundConditionalImportAlias.py new file mode 100644 index 000000000000..d867d1f49287 --- /dev/null +++ b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundConditionalImportAlias.py @@ -0,0 +1,6 @@ +def f(c, x): + if c: + from re import compile as g + else: + pass + return g(x) #fail diff --git a/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundConditionalImportQualified.py b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundConditionalImportQualified.py new file mode 100644 index 000000000000..1e40687e3dab --- /dev/null +++ b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundConditionalImportQualified.py @@ -0,0 +1,6 @@ +def f(c, x): + if c: + import os.path + else: + pass + return os.path.isfile(x) #fail diff --git a/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundDefinedInTryUsedAfterExcept.py b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundDefinedInTryUsedAfterExcept.py new file mode 100644 index 000000000000..4afc68009bd3 --- /dev/null +++ b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundDefinedInTryUsedAfterExcept.py @@ -0,0 +1,6 @@ +def a2(): + try: + a = 2 + except Exception: + pass + print(a) #fail diff --git a/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundExceptAs.py b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundExceptAs.py new file mode 100644 index 000000000000..e9682e0b75b8 --- /dev/null +++ b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundExceptAs.py @@ -0,0 +1,6 @@ +def f(): + try: + raise KeyError("ms") + except KeyError as e: + print(e) #pass + print(e) #fail diff --git a/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundLoopVariable.py b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundLoopVariable.py new file mode 100644 index 000000000000..c3bc9d70f3b5 --- /dev/null +++ b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundLoopVariable.py @@ -0,0 +1,3 @@ +for i, x in enumerate([]): + print(i, x) +print(i) # fail diff --git a/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundNestedComprehension.py b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundNestedComprehension.py new file mode 100644 index 000000000000..22f0a87065cb --- /dev/null +++ b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundNestedComprehension.py @@ -0,0 +1,4 @@ +def f(xs): + # vs is unbound + return [(k, v) for v in vs + for k, vs in xs.items()] diff --git a/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundNonLocal.py b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundNonLocal.py new file mode 100644 index 000000000000..3d1307090707 --- /dev/null +++ b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundNonLocal.py @@ -0,0 +1,24 @@ +def f1(): + nonlocal x #fail + + +def f2(): + def g(): + nonlocal x #fail + print(x) + + +x = 1 + +def f3(): + nonlocal x #fail + x = 2 + + +def f4(): + x = 0 + def g(): + nonlocal x #pass + x = 2 + return x + return g() diff --git a/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundSwapStrUnicode.py b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundSwapStrUnicode.py new file mode 100644 index 000000000000..090eb744fbea --- /dev/null +++ b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundSwapStrUnicode.py @@ -0,0 +1,7 @@ +def f(): + bytes, str = str, unicode #fail + +class C(object): + bytes, str = str, unicode #pass + +bytes, str = str, unicode #pass diff --git a/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundVariableFunctionCall.py b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundVariableFunctionCall.py new file mode 100644 index 000000000000..6a39f123b805 --- /dev/null +++ b/python/testData/inspections/PyUnboundLocalVariableInspection/UnboundVariableFunctionCall.py @@ -0,0 +1,7 @@ +def f(g, h, x): + if x > 1: + z = g + elif x: + z = h + # local z may be unbound, inspection fails only when z is in function call + return z() #fail diff --git a/python/testData/inspections/PyUnboundLocalVariableInspection/UseAfterWithAndRaise.py b/python/testData/inspections/PyUnboundLocalVariableInspection/UseAfterWithAndRaise.py new file mode 100644 index 000000000000..f49b37e01a5c --- /dev/null +++ b/python/testData/inspections/PyUnboundLocalVariableInspection/UseAfterWithAndRaise.py @@ -0,0 +1,7 @@ +def f(y, c, xs): + if c: + raise Exception() + for x in xs: + with y: + pass + print(x) #pass diff --git a/python/testData/inspections/PyUnboundLocalVariableInspection/expected.xml b/python/testData/inspections/PyUnboundLocalVariableInspection/expected.xml deleted file mode 100644 index 5aaae21724f3..000000000000 --- a/python/testData/inspections/PyUnboundLocalVariableInspection/expected.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - test.py - 4 - "Local variable 'a' might be referenced before assignment" - - - test.py - 14 - "Name 'b' can be not defined" - - - test.py - 51 - "Name 'i' can be not defined" - - - test.py - 77 - "Local variable 'z' might be referenced before assignment" - - - test.py - 83 - "Local variable 'vs' might be referenced before assignment" - - - test.py - 123 - "Local variable 'sys' might be referenced before assignment" - - - test.py - 132 - "Local variable 'g' might be referenced before assignment" - - - test.py - 141 - "Local variable 'os' might be referenced before assignment" - - - test.py - 148 - "Local variable 'x' might be referenced before assignment" - - - test.py - 192 - "Local variable 'a' might be referenced before assignment" - - - test.py - 220 - "Local variable 'str' might be referenced before assignment" - - \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/python/PyFormatterTest.java b/python/testSrc/com/jetbrains/python/PyFormatterTest.java index f17d0a2ecd63..7da411bbb1ea 100644 --- a/python/testSrc/com/jetbrains/python/PyFormatterTest.java +++ b/python/testSrc/com/jetbrains/python/PyFormatterTest.java @@ -260,6 +260,10 @@ public class PyFormatterTest extends PyTestCase { doTest(); } + public void testAlignInGenerators() { // PY-8822 + doTest(); + } + public void testContinuationIndentForCallInStatementPart() { // PY-8577 doTest(); } diff --git a/python/testSrc/com/jetbrains/python/PythonAllTestsSuite.java b/python/testSrc/com/jetbrains/python/PythonAllTestsSuite.java index 78950a0aa6ab..7439dddfc5fa 100644 --- a/python/testSrc/com/jetbrains/python/PythonAllTestsSuite.java +++ b/python/testSrc/com/jetbrains/python/PythonAllTestsSuite.java @@ -94,6 +94,7 @@ public class PythonAllTestsSuite { PyCompatibilityInspectionTest.class, PyUnresolvedReferencesInspectionTest.class, PyCallingNonCallableInspectionTest.class, + PyUnboundLocalVariableInspectionTest.class, PyUnusedImportTest.class, PyDeprecationTest.class, PythonHighlightingLexerTest.class, diff --git a/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java b/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java index 3d453c1b101e..0ed83ce7872c 100644 --- a/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java +++ b/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java @@ -129,16 +129,6 @@ public class PythonInspectionsTest extends PyTestCase { doTestWithLanguageLevel(getTestName(false), inspection, LanguageLevel.PYTHON24); } - public void testPyUnboundLocalVariableInspection() { - LocalInspectionTool inspection = new PyUnboundLocalVariableInspection(); - doTestWithLanguageLevel(getTestName(false), inspection, LanguageLevel.PYTHON27); - } - - public void testPyUnboundLocalVariableInspectionPy3k() { - LocalInspectionTool inspection = new PyUnboundLocalVariableInspection(); - doTestWithPy3k(getTestName(false), inspection); - } - public void testPyDocstringInspection() { LocalInspectionTool inspection = new PyDocstringInspection(); doTest(getTestName(false), inspection); diff --git a/python/testSrc/com/jetbrains/python/inspections/PyUnboundLocalVariableInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyUnboundLocalVariableInspectionTest.java new file mode 100644 index 000000000000..b46fb6c655fa --- /dev/null +++ b/python/testSrc/com/jetbrains/python/inspections/PyUnboundLocalVariableInspectionTest.java @@ -0,0 +1,181 @@ +package com.jetbrains.python.inspections; + +import com.jetbrains.python.fixtures.PyTestCase; +import com.jetbrains.python.psi.LanguageLevel; + +/** + * @author vlan + */ +public class PyUnboundLocalVariableInspectionTest extends PyTestCase { + private static final String TEST_DIRECTORY = "inspections/PyUnboundLocalVariableInspection/"; + + public void testSimple() { + doTest(); + } + + // PY-1138 + public void testControlFlowInAssert() { + doTest(); + } + + // PY-1176 + public void testLocalFunctionAndVariable() { + doTest(); + } + + // PY-1359 + public void testUnboundLoopVariable() { + doTest(); + } + + // PY-1408 + public void testUnboundExceptAs() { + runWithLanguageLevel(LanguageLevel.PYTHON33, new Runnable() { + @Override + public void run() { + doTest(); + } + }); + } + + // PY-1434 + public void testClassLevelSameName() { + doTest(); + } + + // PY-1435 + public void testInstanceFieldAndGlobal() { + doTest(); + } + + // PY-3343 + public void testUnboundVariableFunctionCall() { + doTest(); + } + + // PY-3407 + public void testUnboundNestedComprehension() { + doTest(); + } + + // PY-3503 + public void testControlFlowInTryExceptFinally() { + doTest(); + } + + // PY-3550 + public void testDefaultArgument() { + doTest(); + } + + // PY-3583 + public void testUnboundConditionalImport() { + doTest(); + } + + // PY-3603 + public void testUnboundNonLocal() { + runWithLanguageLevel(LanguageLevel.PYTHON33, new Runnable() { + @Override + public void run() { + doTest(); + } + }); + } + + // PY-3671 + public void testUnboundConditionalImportAlias() { + doTest(); + } + + // PY-3665 + public void testUnboundConditionalImportQualified() { + doTest(); + } + + // PY-3651 + public void testUnboundAugmentedAssignment() { + doTest(); + } + + // PY-3702 + public void testSysExit() { + doTest(); + } + + // PY-3895 + public void testDecoratorAndParameter() { + doTest(); + } + + // PY-4102 + public void testDefinedInTryUsedAfter() { + doTest(); + } + + // PY-4150 + public void testParamAfterTryExcept() { + doTest(); + } + + // PY-4151 + public void testUnboundDefinedInTryUsedAfterExcept() { + doTest(); + } + + // PY-4152 + public void testDefinedInTryAndExcept() { + doTest(); + } + + // PY-4157 + public void testDefinedInTryElse() { + doTest(); + } + + // PY-4197 + public void testUnboundSwapStrUnicode() { + doTest(); + } + + // PY-4229 + public void testInstanceAttributeOutsideClass() { + doTest(); + } + + // PY-4297 + public void testOuterFunctionsAndSelfAttributes() { + doTest(); + } + + // PY-4623 + public void testBuiltinAndSelfAttribute() { + doTest(); + } + + // PY-4609 + public void testImplicitIfNotNone() { + doTest(); + } + + // PY-4239 + public void testForBreakElse() { + doTest(); + } + + // PY-5592 + public void testStarImportTopLevel() { + doTest(); + } + + // PY-7966 + public void testUseAfterWithAndRaise() { + doTest(); + } + + private void doTest() { + myFixture.configureByFile(TEST_DIRECTORY + getTestName(false) + ".py"); + myFixture.enableInspections(PyUnboundLocalVariableInspection.class); + myFixture.checkHighlighting(true, false, false); + } +}