diff --git a/python/psi-api/src/com/jetbrains/python/PyNames.java b/python/psi-api/src/com/jetbrains/python/PyNames.java index d2c41cafd965..a7274e40e976 100644 --- a/python/psi-api/src/com/jetbrains/python/PyNames.java +++ b/python/psi-api/src/com/jetbrains/python/PyNames.java @@ -476,7 +476,7 @@ public class PyNames { else if (level.isAtLeast(LanguageLevel.PYTHON35)) { return PY35_BUILTIN_METHODS; } - else if (level.isAtLeast(LanguageLevel.PYTHON30)) { + else if (!level.isPython2()) { return PY3_BUILTIN_METHODS; } else { diff --git a/python/psi-api/src/com/jetbrains/python/psi/LanguageLevel.java b/python/psi-api/src/com/jetbrains/python/psi/LanguageLevel.java index acb244f89250..e0ecd22cfaee 100644 --- a/python/psi-api/src/com/jetbrains/python/psi/LanguageLevel.java +++ b/python/psi-api/src/com/jetbrains/python/psi/LanguageLevel.java @@ -43,6 +43,14 @@ public enum LanguageLevel { PYTHON25(25, false, true, false, false), PYTHON26(26, true, true, false, false), PYTHON27(27, true, true, true, false), + /** + * @deprecated This level is not supported since 2018.1. + * Use it only to distinguish Python 2 and Python 3. + * Consider using {@link LanguageLevel#isPython2()}. + * Replace {@code level.isOlderThan(PYTHON30)} with {@code level.isPython2()} + * and {@code level.isAtLeast(PYTHON30)} with {@code !level.isPython2()}. + */ + @Deprecated PYTHON30(30, true, false, false, true), PYTHON31(31, true, false, true, true), PYTHON32(32, true, false, true, true), @@ -58,8 +66,13 @@ public enum LanguageLevel { @Deprecated public static final List ALL_LEVELS = ImmutableList.copyOf(values()); - public static final List SUPPORTED_LEVELS = ImmutableList.copyOf(Stream.of(values()).filter(v -> v.myVersion >= 26).collect( - Collectors.toList())); // Python versions 2.4 and 2.5 aren't supported anymore + public static final List SUPPORTED_LEVELS = + ImmutableList.copyOf( + Stream + .of(values()) + .filter(v -> v.myVersion >= 26 && v.myVersion != 30) + .collect(Collectors.toList()) + ); private static final LanguageLevel DEFAULT2 = PYTHON27; private static final LanguageLevel DEFAULT3 = PYTHON37; diff --git a/python/python-community-configure/src/com/jetbrains/python/newProject/steps/ProjectSpecificSettingsStep.java b/python/python-community-configure/src/com/jetbrains/python/newProject/steps/ProjectSpecificSettingsStep.java index 8031237595f9..6015cae82a6d 100644 --- a/python/python-community-configure/src/com/jetbrains/python/newProject/steps/ProjectSpecificSettingsStep.java +++ b/python/python-community-configure/src/com/jetbrains/python/newProject/steps/ProjectSpecificSettingsStep.java @@ -41,7 +41,6 @@ import com.jetbrains.python.newProject.PyFrameworkProjectGenerator; import com.jetbrains.python.newProject.PythonProjectGenerator; import com.jetbrains.python.packaging.PyPackage; import com.jetbrains.python.packaging.PyPackageUtil; -import com.jetbrains.python.psi.LanguageLevel; import com.jetbrains.python.sdk.*; import com.jetbrains.python.sdk.add.PyAddSdkGroupPanel; import com.jetbrains.python.sdk.add.PyAddSdkPanel; @@ -348,7 +347,7 @@ public class ProjectSpecificSettingsStep extends ProjectSettingsStepBase i final boolean onlyPython2 = projectGenerator != null && !projectGenerator.supportsPython3(); final Sdk preferred = ContainerUtil.getFirstItem(sdks); if (preferred == null) return null; - if (onlyPython2 && PythonSdkType.getLanguageLevelForSdk(preferred).isAtLeast(LanguageLevel.PYTHON30)) { + if (onlyPython2 && !PythonSdkType.getLanguageLevelForSdk(preferred).isPython2()) { final Sdk python2Sdk = PythonSdkType.findPython2Sdk(sdks); return python2Sdk != null ? python2Sdk : preferred; } diff --git a/python/src/com/jetbrains/python/codeInsight/completion/PyMetaClassCompletionContributor.java b/python/src/com/jetbrains/python/codeInsight/completion/PyMetaClassCompletionContributor.java index 1087f711ba1f..a28c8373dd72 100644 --- a/python/src/com/jetbrains/python/codeInsight/completion/PyMetaClassCompletionContributor.java +++ b/python/src/com/jetbrains/python/codeInsight/completion/PyMetaClassCompletionContributor.java @@ -38,7 +38,7 @@ public class PyMetaClassCompletionContributor extends CompletionContributor { .psiElement() .withLanguage(PythonLanguage.getInstance()) .withParents(PyReferenceExpression.class, PyExpressionStatement.class, PyStatementList.class, PyClass.class) - .and(hasLanguageLevel(level -> level.isOlderThan(LanguageLevel.PYTHON30))), + .and(hasLanguageLevel(LanguageLevel::isPython2)), new CompletionProvider() { @Override protected void addCompletions(@NotNull CompletionParameters parameters, @@ -52,7 +52,7 @@ public class PyMetaClassCompletionContributor extends CompletionContributor { .psiElement() .withLanguage(PythonLanguage.getInstance()) .withParents(PyReferenceExpression.class, PyArgumentList.class, PyClass.class) - .and(hasLanguageLevel(level -> level.isAtLeast(LanguageLevel.PYTHON30))), + .and(hasLanguageLevel(level -> !level.isPython2())), new CompletionProvider() { @Override protected void addCompletions(@NotNull CompletionParameters parameters, diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/ConvertVariadicParamIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/ConvertVariadicParamIntention.java index 44c5108ea84e..1b590fc51e8b 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/ConvertVariadicParamIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/ConvertVariadicParamIntention.java @@ -74,7 +74,7 @@ public class ConvertVariadicParamIntention extends PyBaseIntentionAction { final PyFunction function = PsiTreeUtil.getParentOfType(element, PyFunction.class); if (function != null) { - if (LanguageLevel.forElement(function).isOlderThan(LanguageLevel.PYTHON30) && function.getParameterList().hasPositionalContainer()) { + if (LanguageLevel.forElement(function).isPython2() && function.getParameterList().hasPositionalContainer()) { return false; } diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/SpecifyTypeInPy3AnnotationsIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/SpecifyTypeInPy3AnnotationsIntention.java index 4846d359255e..18ff6b2d9640 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/SpecifyTypeInPy3AnnotationsIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/SpecifyTypeInPy3AnnotationsIntention.java @@ -49,11 +49,13 @@ import org.jetbrains.annotations.NotNull; public class SpecifyTypeInPy3AnnotationsIntention extends TypeIntention { private String myText = PyBundle.message("INTN.specify.type.in.annotation"); + @Override @NotNull public String getText() { return myText; } + @Override @NotNull public String getFamilyName() { return PyBundle.message("INTN.specify.type.in.annotation"); @@ -211,7 +213,7 @@ public class SpecifyTypeInPy3AnnotationsIntention extends TypeIntention { } private static boolean isDefinedInAnnotation(PyParameter parameter) { - if (LanguageLevel.forElement(parameter).isOlderThan(LanguageLevel.PYTHON30)) { + if (LanguageLevel.forElement(parameter).isPython2()) { return false; } if (parameter instanceof PyNamedParameter && (((PyNamedParameter)parameter).getAnnotation() != null)) return true; diff --git a/python/src/com/jetbrains/python/codeInsight/override/PyOverrideImplementUtil.java b/python/src/com/jetbrains/python/codeInsight/override/PyOverrideImplementUtil.java index 0fac595c0334..5a820ee81841 100644 --- a/python/src/com/jetbrains/python/codeInsight/override/PyOverrideImplementUtil.java +++ b/python/src/com/jetbrains/python/codeInsight/override/PyOverrideImplementUtil.java @@ -206,7 +206,7 @@ public class PyOverrideImplementUtil { } final LanguageLevel level = LanguageLevel.forElement(pyClass); PyAnnotation anno = baseFunction.getAnnotation(); - if (anno != null && level.isAtLeast(LanguageLevel.PYTHON30)) { + if (anno != null && !level.isPython2()) { pyFunctionBuilder.annotation(anno.getText()); } if (baseFunction.isAsync()) { @@ -228,7 +228,7 @@ public class PyOverrideImplementUtil { } parameterBuilder.append(namedParameter.getName()); final PyAnnotation annotation = namedParameter.getAnnotation(); - if (annotation != null && level.isAtLeast(LanguageLevel.PYTHON30)) { + if (annotation != null && !level.isPython2()) { parameterBuilder.append(annotation.getText()); } final PyExpression defaultValue = namedParameter.getDefaultValue(); diff --git a/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java b/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java index b2c12e9814f2..339e46ccf14a 100644 --- a/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java +++ b/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java @@ -510,7 +510,7 @@ public class PyStdlibTypeProvider extends PyTypeProviderBase { @NotNull TypeEvalContext context) { final LanguageLevel typeLevel = ArrayUtil.contains(functionQName, "io.open", "pathlib.Path.open", "_io.open") - ? LanguageLevel.PYTHON30 + ? LanguageLevel.PYTHON34 : LanguageLevel.forElement(call); return PyTypingTypeProvider.getOpenFunctionCallType(function, call, typeLevel, context); diff --git a/python/src/com/jetbrains/python/inspections/PyCompatibilityInspection.java b/python/src/com/jetbrains/python/inspections/PyCompatibilityInspection.java index 8cea79bf9434..8b3c87ce821d 100644 --- a/python/src/com/jetbrains/python/inspections/PyCompatibilityInspection.java +++ b/python/src/com/jetbrains/python/inspections/PyCompatibilityInspection.java @@ -271,7 +271,7 @@ public class PyCompatibilityInspection extends PyInspection { public void visitPyArgumentList(final PyArgumentList node) { //PY-5588 if (node.getParent() instanceof PyClass) { final boolean isPython2 = LanguageLevel.forElement(node).isPython2(); - if (myVersionsToProcess.stream().anyMatch(level -> level.isOlderThan(LanguageLevel.PYTHON30)) || isPython2) { + if (isPython2 || myVersionsToProcess.stream().anyMatch(LanguageLevel::isPython2)) { Arrays .stream(node.getArguments()) .filter(PyKeywordArgument.class::isInstance) diff --git a/python/src/com/jetbrains/python/inspections/PyCompatibilityInspectionAdvertiser.java b/python/src/com/jetbrains/python/inspections/PyCompatibilityInspectionAdvertiser.java index d9cdc9340b49..67c5b6abe050 100644 --- a/python/src/com/jetbrains/python/inspections/PyCompatibilityInspectionAdvertiser.java +++ b/python/src/com/jetbrains/python/inspections/PyCompatibilityInspectionAdvertiser.java @@ -121,7 +121,7 @@ public class PyCompatibilityInspectionAdvertiser implements Annotator { @Nullable private static LanguageLevel getLatestConfiguredCompatiblePython3Version(@NotNull PsiElement element) { final LanguageLevel latestVersion = getLatestConfiguredCompatiblePythonVersion(element); - return latestVersion != null && latestVersion.isAtLeast(LanguageLevel.PYTHON30) ? latestVersion : null; + return latestVersion != null && !latestVersion.isPython2() ? latestVersion : null; } private static void showStalePython3VersionWarning(@NotNull PyFile file, diff --git a/python/src/com/jetbrains/python/inspections/PyDunderSlotsInspection.kt b/python/src/com/jetbrains/python/inspections/PyDunderSlotsInspection.kt index a4a24f14df06..1b2139b4ff69 100644 --- a/python/src/com/jetbrains/python/inspections/PyDunderSlotsInspection.kt +++ b/python/src/com/jetbrains/python/inspections/PyDunderSlotsInspection.kt @@ -21,7 +21,7 @@ class PyDunderSlotsInspection : PyInspection() { override fun visitPyClass(node: PyClass?) { super.visitPyClass(node) - if (node != null && LanguageLevel.forElement(node).isAtLeast(LanguageLevel.PYTHON30)) { + if (node != null && !LanguageLevel.forElement(node).isPython2) { val slots = findSlotsValue(node) when (slots) { @@ -91,7 +91,7 @@ class PyDunderSlotsInspection : PyInspection() { Py3+ raises ValueError about conflict between __slots__ and class variable. This case is handled above by com.jetbrains.python.inspections.PyDunderSlotsInspection.Visitor.processSlot method. */ - if (LanguageLevel.forElement(cls).isOlderThan(LanguageLevel.PYTHON30)) { + if (LanguageLevel.forElement(cls).isPython2) { return attributeIsWritableInPy2(cls, name) } else { diff --git a/python/src/com/jetbrains/python/inspections/PyMethodMayBeStaticInspection.java b/python/src/com/jetbrains/python/inspections/PyMethodMayBeStaticInspection.java index d2196dba44d1..95f3c16fa837 100644 --- a/python/src/com/jetbrains/python/inspections/PyMethodMayBeStaticInspection.java +++ b/python/src/com/jetbrains/python/inspections/PyMethodMayBeStaticInspection.java @@ -124,7 +124,7 @@ public class PyMethodMayBeStaticInspection extends PyInspection { @Override public void visitPyCallExpression(PyCallExpression node) { super.visitPyCallExpression(node); - if (LanguageLevel.forElement(node).isAtLeast(LanguageLevel.PYTHON30) && node.isCalleeText(PyNames.SUPER)) { + if (!LanguageLevel.forElement(node).isPython2() && node.isCalleeText(PyNames.SUPER)) { mayBeStatic[0] = false; } } diff --git a/python/src/com/jetbrains/python/inspections/PyMissingConstructorInspection.java b/python/src/com/jetbrains/python/inspections/PyMissingConstructorInspection.java index c0cc4f0ce6bf..07ba288698bc 100644 --- a/python/src/com/jetbrains/python/inspections/PyMissingConstructorInspection.java +++ b/python/src/com/jetbrains/python/inspections/PyMissingConstructorInspection.java @@ -180,7 +180,7 @@ public class PyMissingConstructorInspection extends PyInspection { if (firstArg.equals(cls.getName()) || firstArg.equals(CANONICAL_SELF + "." + __CLASS__) || classQName != null && classQName.endsWith(firstArg) || - firstArg.equals(__CLASS__) && LanguageLevel.forElement(cls).isAtLeast(LanguageLevel.PYTHON30)) { + firstArg.equals(__CLASS__) && !LanguageLevel.forElement(cls).isPython2()) { return true; } diff --git a/python/src/com/jetbrains/python/inspections/PyTupleAssignmentBalanceInspection.java b/python/src/com/jetbrains/python/inspections/PyTupleAssignmentBalanceInspection.java index cf322f09e5a1..22a014f4192f 100644 --- a/python/src/com/jetbrains/python/inspections/PyTupleAssignmentBalanceInspection.java +++ b/python/src/com/jetbrains/python/inspections/PyTupleAssignmentBalanceInspection.java @@ -20,7 +20,6 @@ import com.intellij.codeInspection.ProblemsHolder; import com.intellij.psi.PsiElementVisitor; import com.intellij.util.ArrayUtil; import com.jetbrains.python.PyBundle; -import com.jetbrains.python.codeInsight.stdlib.PyNamedTupleType; import com.jetbrains.python.psi.*; import com.jetbrains.python.psi.impl.PyPsiUtils; import com.jetbrains.python.psi.types.PyNoneType; @@ -110,9 +109,6 @@ public class PyTupleAssignmentBalanceInspection extends PyInspection { if (assignedType instanceof PyTupleType) { return ((PyTupleType)assignedType).getElementCount(); } - else if (assignedType instanceof PyNamedTupleType) { - return ((PyNamedTupleType)assignedType).getElementCount(); - } else if (assignedType instanceof PyNoneType) { return 1; } @@ -121,7 +117,7 @@ public class PyTupleAssignmentBalanceInspection extends PyInspection { } private static int countStarExpressions(@NotNull PyExpression[] expressions) { - if (expressions.length != 0 && LanguageLevel.forElement(expressions[0]).isAtLeast(LanguageLevel.PYTHON30)) { + if (expressions.length != 0 && !LanguageLevel.forElement(expressions[0]).isPython2()) { return (int) Arrays .stream(expressions) .filter(PyStarExpression.class::isInstance) diff --git a/python/src/com/jetbrains/python/inspections/quickfix/PyMakeFunctionReturnTypeQuickFix.java b/python/src/com/jetbrains/python/inspections/quickfix/PyMakeFunctionReturnTypeQuickFix.java index 055bd4a53809..765499484165 100644 --- a/python/src/com/jetbrains/python/inspections/quickfix/PyMakeFunctionReturnTypeQuickFix.java +++ b/python/src/com/jetbrains/python/inspections/quickfix/PyMakeFunctionReturnTypeQuickFix.java @@ -47,6 +47,7 @@ public class PyMakeFunctionReturnTypeQuickFix implements LocalQuickFix { myReturnTypeName = (returnTypeName == null) ? PythonDocumentationProvider.getTypeName(function.getReturnStatementType(context), context) : returnTypeName; } + @Override @NotNull public String getName() { PyFunction function = myFunction.getElement(); @@ -54,11 +55,13 @@ public class PyMakeFunctionReturnTypeQuickFix implements LocalQuickFix { return PyBundle.message("QFIX.NAME.make.$0.return.$1", functionName, myReturnTypeName); } + @Override @NotNull public String getFamilyName() { return PyBundle.message("QFIX.NAME.make.$0.return.$1", "function", "inferred type"); } + @Override public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PyElementGenerator elementGenerator = PyElementGenerator.getInstance(project); if (myAnnotation != null) { @@ -66,7 +69,7 @@ public class PyMakeFunctionReturnTypeQuickFix implements LocalQuickFix { if (annotation != null) { final PyExpression annotationExpr = annotation.getValue(); if (annotationExpr == null) return; - annotationExpr.replace(elementGenerator.createExpressionFromText(LanguageLevel.PYTHON30, myReturnTypeName)); + annotationExpr.replace(elementGenerator.createExpressionFromText(LanguageLevel.PYTHON34, myReturnTypeName)); } } else if (myTypeCommentAnnotation != null) { diff --git a/python/src/com/jetbrains/python/psi/PyUtil.java b/python/src/com/jetbrains/python/psi/PyUtil.java index 235df15ff03f..c2494f727a8d 100644 --- a/python/src/com/jetbrains/python/psi/PyUtil.java +++ b/python/src/com/jetbrains/python/psi/PyUtil.java @@ -48,7 +48,6 @@ import com.intellij.psi.util.*; import com.intellij.ui.awt.RelativePoint; import com.intellij.util.*; import com.intellij.util.containers.ContainerUtil; -import java.util.HashSet; import com.jetbrains.NotNullPredicate; import com.jetbrains.python.PyBundle; import com.jetbrains.python.PyNames; @@ -513,10 +512,7 @@ public class PyUtil { } // Magic literals are always represented by their string values if ((element instanceof PyStringLiteralExpression) && PyMagicLiteralTools.isMagicLiteral(element)) { - final String name = ((StringLiteralExpression)element).getStringValue(); - if (name != null) { - return name; - } + return ((StringLiteralExpression)element).getStringValue(); } if (element instanceof PyElement) { final String name = ((PyElement)element).getName(); @@ -528,7 +524,7 @@ public class PyUtil { } public static boolean isOwnScopeComprehension(@NotNull PyComprehensionElement comprehension) { - final boolean isAtLeast30 = LanguageLevel.forElement(comprehension).isAtLeast(LanguageLevel.PYTHON30); + final boolean isAtLeast30 = !LanguageLevel.forElement(comprehension).isPython2(); final boolean isListComprehension = comprehension instanceof PyListCompExpression; return !isListComprehension || isAtLeast30; } @@ -874,7 +870,7 @@ public class PyUtil { } public static boolean isPy2ReservedWord(@NotNull PyReferenceExpression node) { - if (LanguageLevel.forElement(node).isOlderThan(LanguageLevel.PYTHON30)) { + if (LanguageLevel.forElement(node).isPython2()) { if (!node.isQualified()) { final String name = node.getName(); if (PyNames.NONE.equals(name) || PyNames.FALSE.equals(name) || PyNames.TRUE.equals(name)) { diff --git a/python/src/com/jetbrains/python/psi/impl/PyClassImpl.java b/python/src/com/jetbrains/python/psi/impl/PyClassImpl.java index 800170146b4c..d9e7f8aea8a7 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyClassImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyClassImpl.java @@ -1420,7 +1420,7 @@ public class PyClassImpl extends PyBaseElementImpl implements PyCla return null; } - if (LanguageLevel.forElement(this).isOlderThan(LanguageLevel.PYTHON30) && getMetaClassQName() == null) { + if (LanguageLevel.forElement(this).isPython2() && getMetaClassQName() == null) { final QualifiedName typesInstanceTypeQName = QualifiedName.fromDottedString(PyNames.TYPES_INSTANCE_TYPE); final PsiElement typesInstanceType = resolveTopLevelMember(typesInstanceTypeQName, fromFoothold(this)); @@ -1493,7 +1493,7 @@ public class PyClassImpl extends PyBaseElementImpl implements PyCla } } final LanguageLevel level = LanguageLevel.forElement(this); - if (level.isOlderThan(LanguageLevel.PYTHON30)) { + if (level.isPython2()) { final PsiFile file = getContainingFile(); if (file instanceof PyFile) { final PyFile pyFile = (PyFile)file; @@ -1589,7 +1589,7 @@ public class PyClassImpl extends PyBaseElementImpl implements PyCla @Override public PyExpression getMetaClassExpression() { final LanguageLevel level = LanguageLevel.forElement(this); - if (level.isAtLeast(LanguageLevel.PYTHON30)) { + if (!level.isPython2()) { // Requires AST access for (PyExpression expression : getSuperClassExpressions()) { if (expression instanceof PyKeywordArgument) { diff --git a/python/src/com/jetbrains/python/psi/impl/PyStringLiteralExpressionImpl.java b/python/src/com/jetbrains/python/psi/impl/PyStringLiteralExpressionImpl.java index 3914a867f6ba..6f54cfd10327 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyStringLiteralExpressionImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyStringLiteralExpressionImpl.java @@ -98,6 +98,7 @@ public class PyStringLiteralExpressionImpl extends PyElementImpl implements PySt pyVisitor.visitPyStringLiteralExpression(this); } + @Override public void subtreeChanged() { super.subtreeChanged(); myStringValue = null; @@ -105,6 +106,7 @@ public class PyStringLiteralExpressionImpl extends PyElementImpl implements PySt myDecodedFragments = null; } + @Override @NotNull public List getStringValueTextRanges() { List result = myValueTextRanges; @@ -144,7 +146,7 @@ public class PyStringLiteralExpressionImpl extends PyElementImpl implements PySt } private boolean isUnicodeByDefault() { - if (LanguageLevel.forElement(this).isAtLeast(LanguageLevel.PYTHON30)) { + if (!LanguageLevel.forElement(this).isPython2()) { return true; } final PsiFile file = getContainingFile(); @@ -251,6 +253,7 @@ public class PyStringLiteralExpressionImpl extends PyElementImpl implements PySt return matcher.group(group.ordinal()); } + @Override @NotNull public List getStringNodes() { return Arrays.asList(getNode().getChildren(PyTokenTypes.STRING_NODES)); @@ -300,6 +303,7 @@ public class PyStringLiteralExpressionImpl extends PyElementImpl implements PySt return true; } + @Override public PyType getType(@NotNull TypeEvalContext context, @NotNull TypeEvalContext.Key key) { final List nodes = getStringNodes(); if (nodes.size() > 0) { @@ -440,6 +444,7 @@ public class PyStringLiteralExpressionImpl extends PyElementImpl implements PySt return createLiteralTextEscaper().getOffsetInHost(valueOffset, getStringValueTextRange()); } + @Override public boolean characterNeedsEscaping(char c) { if (c == '#') { return isVerboseInjection(); @@ -460,18 +465,22 @@ public class PyStringLiteralExpressionImpl extends PyElementImpl implements PySt return false; } + @Override public boolean supportsPerl5EmbeddedComments() { return true; } + @Override public boolean supportsPossessiveQuantifiers() { return false; } + @Override public boolean supportsPythonConditionalRefs() { return true; } + @Override public boolean supportsNamedGroupSyntax(RegExpGroup group) { return group.getType() == RegExpGroup.Type.PYTHON_NAMED_GROUP; } diff --git a/python/src/com/jetbrains/python/psi/impl/PyTargetExpressionImpl.java b/python/src/com/jetbrains/python/psi/impl/PyTargetExpressionImpl.java index 4a9d93a773ef..12cfb2f29be8 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyTargetExpressionImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyTargetExpressionImpl.java @@ -428,7 +428,7 @@ public class PyTargetExpressionImpl extends PyBaseElementImpl parameters = getParameters(context); diff --git a/python/src/com/jetbrains/python/psi/types/PyTypeChecker.java b/python/src/com/jetbrains/python/psi/types/PyTypeChecker.java index 8c6939df6176..40767851c35b 100644 --- a/python/src/com/jetbrains/python/psi/types/PyTypeChecker.java +++ b/python/src/com/jetbrains/python/psi/types/PyTypeChecker.java @@ -666,7 +666,7 @@ public class PyTypeChecker { final boolean isPy2 = subClassFile instanceof PyiFile ? PyBuiltinCache.getInstance(subClass).getObjectType(PyNames.TYPE_UNICODE) != null - : LanguageLevel.forElement(subClass).isOlderThan(LanguageLevel.PYTHON30); + : LanguageLevel.forElement(subClass).isPython2(); final String superClassName = superClass.getName(); return isPy2 && PyNames.TYPE_STR.equals(superClassName) || !isPy2 && PyNames.TYPE_BYTES.equals(superClassName); diff --git a/python/src/com/jetbrains/python/sdk/PythonSdkType.java b/python/src/com/jetbrains/python/sdk/PythonSdkType.java index 1404e5c88efb..474672cb9e0f 100644 --- a/python/src/com/jetbrains/python/sdk/PythonSdkType.java +++ b/python/src/com/jetbrains/python/sdk/PythonSdkType.java @@ -138,7 +138,7 @@ public final class PythonSdkType extends SdkType { @NonNls public static String getBuiltinsFileName(@NotNull Sdk sdk) { final LanguageLevel level = getLanguageLevelForSdk(sdk); - return level.isOlderThan(LanguageLevel.PYTHON30) ? PyBuiltinCache.BUILTIN_FILE : PyBuiltinCache.BUILTIN_FILE_3K; + return level.isPython2() ? PyBuiltinCache.BUILTIN_FILE : PyBuiltinCache.BUILTIN_FILE_3K; } @Override diff --git a/python/src/com/jetbrains/python/validation/CompatibilityVisitor.java b/python/src/com/jetbrains/python/validation/CompatibilityVisitor.java index 45de081927e7..0a0473825c06 100644 --- a/python/src/com/jetbrains/python/validation/CompatibilityVisitor.java +++ b/python/src/com/jetbrains/python/validation/CompatibilityVisitor.java @@ -50,8 +50,6 @@ public abstract class CompatibilityVisitor extends PyAnnotator { static { AVAILABLE_PREFIXES.put(LanguageLevel.PYTHON26, Sets.newHashSet("R", "U", "UR", "B", "BR")); AVAILABLE_PREFIXES.put(LanguageLevel.PYTHON27, Sets.newHashSet("R", "U", "UR", "B", "BR")); - AVAILABLE_PREFIXES.put(LanguageLevel.PYTHON30, Sets.newHashSet("R", "B")); - AVAILABLE_PREFIXES.put(LanguageLevel.PYTHON31, Sets.newHashSet("R", "B", "BR")); AVAILABLE_PREFIXES.put(LanguageLevel.PYTHON32, Sets.newHashSet("R", "B", "BR")); AVAILABLE_PREFIXES.put(LanguageLevel.PYTHON36, Sets.newHashSet("R", "U", "B", "BR", "RB", "F", "FR", "RF")); AVAILABLE_PREFIXES.put(LanguageLevel.PYTHON37, Sets.newHashSet("R", "U", "B", "BR", "RB", "F", "FR", "RF")); @@ -134,7 +132,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator { if (qName != null) { if (qName.matches("builtins")) { - registerForAllMatchingVersions(level -> level.isPython2(), " not have module builtins", node, new ReplaceBuiltinsQuickFix()); + registerForAllMatchingVersions(LanguageLevel::isPython2, " not have module builtins", node, new ReplaceBuiltinsQuickFix()); } else if (qName.matches("__builtin__")) { registerForAllMatchingVersions(LanguageLevel::isPy3K, " not have module __builtin__", node, new ReplaceBuiltinsQuickFix()); @@ -148,7 +146,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator { super.visitPyStarExpression(node); if (node.isAssignmentTarget()) { - registerOnFirstMatchingVersion(level -> level.isOlderThan(LanguageLevel.PYTHON30), + registerOnFirstMatchingVersion(LanguageLevel::isPython2, "Python versions < 3.0 do not support starred expressions as assignment targets", node); } @@ -330,7 +328,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator { final PsiElement firstChild = node.getFirstChild(); if (firstChild != null && PyNames.SUPER.equals(firstChild.getText()) && ArrayUtil.isEmpty(node.getArguments())) { - registerForAllMatchingVersions(level -> level.isPython2(), + registerForAllMatchingVersions(LanguageLevel::isPython2, " not support this syntax. super() should have arguments in Python 2", node, null); @@ -407,7 +405,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator { if (sliceItem != null) { return; } - registerOnFirstMatchingVersion(level -> level.isOlderThan(LanguageLevel.PYTHON30), + registerOnFirstMatchingVersion(LanguageLevel::isPython2, "Python versions < 3.0 do not support '...' outside of sequence slicings.", node); } @@ -557,7 +555,7 @@ public abstract class CompatibilityVisitor extends PyAnnotator { @Override public void visitPyNonlocalStatement(final PyNonlocalStatement node) { - registerOnFirstMatchingVersion(level -> level.isOlderThan(LanguageLevel.PYTHON30), "nonlocal keyword available only since py3", node); + registerOnFirstMatchingVersion(LanguageLevel::isPython2, "nonlocal keyword available only since py3", node); } private void highlightIncorrectArguments(@NotNull PyCallExpression callExpression) { diff --git a/python/testData/highlighting/unsupportedFeaturesInPython3.py b/python/testData/highlighting/unsupportedFeaturesInPython3.py index d690cbfdd433..9057c2a89cda 100644 --- a/python/testData/highlighting/unsupportedFeaturesInPython3.py +++ b/python/testData/highlighting/unsupportedFeaturesInPython3.py @@ -1,22 +1,22 @@ -print(a <> 3) -`foo()` -a = 123l -a = 043 +print(a <> 3) +`foo()` +a = 123l +a = 043 a = 0X43 a = 0b1 a = 0.0 -s = u"text" -raise a, b, c -raise a, b +s = u"text" +raise a, b, c +raise a, b try: pass -except a, name: +except a, name: pass -[x * 2 for x in vec1, vec2] +[x * 2 for x in vec1, vec2] -import __builtin__ +import __builtin__ raise diff --git a/python/testData/inspections/DictComprehensionToCall.py b/python/testData/inspections/DictComprehensionToCall.py index 51ab6baede09..506e95bf63f9 100644 --- a/python/testData/inspections/DictComprehensionToCall.py +++ b/python/testData/inspections/DictComprehensionToCall.py @@ -1 +1 @@ -var = {k: v for k, v in zip('abc', range(3)) if k % 2} \ No newline at end of file +var = {k: v for k, v in zip('abc', range(3)) if k % 2} \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/asyncComprehensions.py b/python/testData/inspections/PyCompatibilityInspection/asyncComprehensions.py index ff4289166426..4cbdd8ba201c 100644 --- a/python/testData/inspections/PyCompatibilityInspection/asyncComprehensions.py +++ b/python/testData/inspections/PyCompatibilityInspection/asyncComprehensions.py @@ -1,16 +1,16 @@ async def asyncgen(): yield 10 async def run(): - {i async for i in asyncgen()} + {i async for i in asyncgen()} [i async for i in asyncgen()] - {i: i ** 2 async for i in asyncgen()} + {i: i ** 2 async for i in asyncgen()} (i ** 2 async for i in asyncgen()) list(i async for i in asyncgen()) - dataset = {data for line in gen() + dataset = {data for line in gen() async for data in line if check(data)} - dataset = {data async for line in asyncgen() + dataset = {data async for line in asyncgen() async for data in line if check(data)} \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/awaitInComprehensions.py b/python/testData/inspections/PyCompatibilityInspection/awaitInComprehensions.py index 6ca8c2bce2eb..db819f754bd4 100644 --- a/python/testData/inspections/PyCompatibilityInspection/awaitInComprehensions.py +++ b/python/testData/inspections/PyCompatibilityInspection/awaitInComprehensions.py @@ -1,16 +1,16 @@ async def async2(): [await fun() for fun in funcs] - {await fun() for fun in funcs} - {fun: await fun() for fun in funcs} + {await fun() for fun in funcs} + {fun: await fun() for fun in funcs} [await fun() for fun in funcs if await smth] - {await fun() for fun in funcs if await smth} - {fun: await fun() for fun in funcs if await smth} + {await fun() for fun in funcs if await smth} + {fun: await fun() for fun in funcs if await smth} [await fun() async for fun in funcs] - {await fun() async for fun in funcs} - {fun: await fun() async for fun in funcs} + {await fun() async for fun in funcs} + {fun: await fun() async for fun in funcs} [await fun() async for fun in funcs if await smth] - {await fun() async for fun in funcs if await smth} - {fun: await fun() async for fun in funcs if await smth} \ No newline at end of file + {await fun() async for fun in funcs if await smth} + {fun: await fun() async for fun in funcs if await smth} \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/binaryExpression.py b/python/testData/inspections/PyCompatibilityInspection/binaryExpression.py index f582416d002f..0ea8f2dbfac5 100644 --- a/python/testData/inspections/PyCompatibilityInspection/binaryExpression.py +++ b/python/testData/inspections/PyCompatibilityInspection/binaryExpression.py @@ -1,4 +1,4 @@ -print(a <> b) +print(a <> b) -if a <> 2: +if a <> 2: var = a \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/builtinLong.py b/python/testData/inspections/PyCompatibilityInspection/builtinLong.py index f21723502815..35340e752a7c 100644 --- a/python/testData/inspections/PyCompatibilityInspection/builtinLong.py +++ b/python/testData/inspections/PyCompatibilityInspection/builtinLong.py @@ -1 +1 @@ -long("abc") \ No newline at end of file +long("abc") \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/callExpression.py b/python/testData/inspections/PyCompatibilityInspection/callExpression.py index d7dbdbc990bd..2b2e0c90fa39 100644 --- a/python/testData/inspections/PyCompatibilityInspection/callExpression.py +++ b/python/testData/inspections/PyCompatibilityInspection/callExpression.py @@ -2,7 +2,7 @@ class A(B): def __init__(self): super() -cmp() -reduce() +cmp() +reduce() -buffer() \ No newline at end of file +buffer() \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/dictCompExpression.py b/python/testData/inspections/PyCompatibilityInspection/dictCompExpression.py index a43d3caae29d..6a9e4247814f 100644 --- a/python/testData/inspections/PyCompatibilityInspection/dictCompExpression.py +++ b/python/testData/inspections/PyCompatibilityInspection/dictCompExpression.py @@ -1 +1 @@ -var = {i : chr(65+i) for i in range(4)} +var = {i : chr(65+i) for i in range(4)} diff --git a/python/testData/inspections/PyCompatibilityInspection/exceptBlock.py b/python/testData/inspections/PyCompatibilityInspection/exceptBlock.py index 00d6d824a838..163968d37f93 100644 --- a/python/testData/inspections/PyCompatibilityInspection/exceptBlock.py +++ b/python/testData/inspections/PyCompatibilityInspection/exceptBlock.py @@ -1,4 +1,4 @@ try: do_smth() -except ImportError, ImportWarning: +except ImportError, ImportWarning: do() \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/fromImportStatement.py b/python/testData/inspections/PyCompatibilityInspection/fromImportStatement.py index 99e82d734b81..af8a69c79ea2 100644 --- a/python/testData/inspections/PyCompatibilityInspection/fromImportStatement.py +++ b/python/testData/inspections/PyCompatibilityInspection/fromImportStatement.py @@ -1 +1 @@ -from Bastion import BastionClass \ No newline at end of file +from Bastion import BastionClass \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/importElement.py b/python/testData/inspections/PyCompatibilityInspection/importElement.py index 7e6cf2f3c374..0733e69cfc38 100644 --- a/python/testData/inspections/PyCompatibilityInspection/importElement.py +++ b/python/testData/inspections/PyCompatibilityInspection/importElement.py @@ -1 +1 @@ -import Bastion \ No newline at end of file +import Bastion \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/importStatement.py b/python/testData/inspections/PyCompatibilityInspection/importStatement.py index 40992091a58f..f88151230853 100644 --- a/python/testData/inspections/PyCompatibilityInspection/importStatement.py +++ b/python/testData/inspections/PyCompatibilityInspection/importStatement.py @@ -1,3 +1,3 @@ import builtins -import __builtin__ \ No newline at end of file +import __builtin__ \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/listCompExpression.py b/python/testData/inspections/PyCompatibilityInspection/listCompExpression.py index fefc2b40b24b..6315ec89768f 100644 --- a/python/testData/inspections/PyCompatibilityInspection/listCompExpression.py +++ b/python/testData/inspections/PyCompatibilityInspection/listCompExpression.py @@ -1 +1 @@ -var = [x for x in 1, 2, 3] \ No newline at end of file +var = [x for x in 1, 2, 3] \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/numericLiteralExpression.py b/python/testData/inspections/PyCompatibilityInspection/numericLiteralExpression.py index 87734f80ce08..360206b4966a 100644 --- a/python/testData/inspections/PyCompatibilityInspection/numericLiteralExpression.py +++ b/python/testData/inspections/PyCompatibilityInspection/numericLiteralExpression.py @@ -1,2 +1,2 @@ -a = 12l -v = 048 \ No newline at end of file +a = 12l +v = 048 \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/raiseMultipleArgs.py b/python/testData/inspections/PyCompatibilityInspection/raiseMultipleArgs.py index 9b802b02b1f9..590d032e82cf 100644 --- a/python/testData/inspections/PyCompatibilityInspection/raiseMultipleArgs.py +++ b/python/testData/inspections/PyCompatibilityInspection/raiseMultipleArgs.py @@ -1,4 +1,4 @@ try: a except : - raise ImportError, ImportWarning + raise ImportError, ImportWarning diff --git a/python/testData/inspections/PyCompatibilityInspection/reprExpression.py b/python/testData/inspections/PyCompatibilityInspection/reprExpression.py index 7be8a9cc21ad..1efe4a463f7f 100644 --- a/python/testData/inspections/PyCompatibilityInspection/reprExpression.py +++ b/python/testData/inspections/PyCompatibilityInspection/reprExpression.py @@ -1 +1 @@ -a = `imp.acquire_lock()` +a = `imp.acquire_lock()` diff --git a/python/testData/inspections/PyCompatibilityInspection/setCompExpression.py b/python/testData/inspections/PyCompatibilityInspection/setCompExpression.py index e33a83ab6ec3..960187c4a003 100644 --- a/python/testData/inspections/PyCompatibilityInspection/setCompExpression.py +++ b/python/testData/inspections/PyCompatibilityInspection/setCompExpression.py @@ -1 +1 @@ -var = {i for i in range(2)} +var = {i for i in range(2)} diff --git a/python/testData/inspections/PyCompatibilityInspection/setLiteralExpression.py b/python/testData/inspections/PyCompatibilityInspection/setLiteralExpression.py index b97c93d9eece..8d3fbe4505e5 100644 --- a/python/testData/inspections/PyCompatibilityInspection/setLiteralExpression.py +++ b/python/testData/inspections/PyCompatibilityInspection/setLiteralExpression.py @@ -1 +1 @@ -var = {1, 2} +var = {1, 2} diff --git a/python/testData/inspections/PyCompatibilityInspection/stringLiteralExpression.py b/python/testData/inspections/PyCompatibilityInspection/stringLiteralExpression.py index 9e69ff691389..62a148ad329d 100644 --- a/python/testData/inspections/PyCompatibilityInspection/stringLiteralExpression.py +++ b/python/testData/inspections/PyCompatibilityInspection/stringLiteralExpression.py @@ -1,30 +1,30 @@ -a = u"String" +a = u"String" # Python 3.6 -a = f"" -a = F"" -a = rf"" -a = fr"" -a = fu"" -a = uf"" -a = bf"" -a = fb"" -a = ufr"" +a = f"" +a = F"" +a = rf"" +a = fr"" +a = fu"" +a = uf"" +a = bf"" +a = fb"" +a = ufr"" # python 3.3 -a = u"" +a = u"" a = r"" a = b"" -a = rb"" -a = br"" +a = rb"" +a = br"" # python 3.2, 3.1 a = r"" a = b"" -a = br"" +a = br"" # python 3.0 @@ -33,22 +33,22 @@ a = b"" # python 2.7, 2.6 -a = u"" +a = u"" a = r"" -a = ur"" +a = ur"" a = b"" -a = br"" +a = br"" # python 2.5 -a = u"" +a = u"" a = r"" -a = ur"" +a = ur"" # combined -b = u"" b"" +b = u"" b"" # never was available -a = rr"" -a = bb"" -a = uu"" \ No newline at end of file +a = rr"" +a = bb"" +a = uu"" \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/underscoreBz2Module.py b/python/testData/inspections/PyCompatibilityInspection/underscoreBz2Module.py index 42b5f0990e13..744e668c4e19 100644 --- a/python/testData/inspections/PyCompatibilityInspection/underscoreBz2Module.py +++ b/python/testData/inspections/PyCompatibilityInspection/underscoreBz2Module.py @@ -1 +1 @@ -import _bz2 \ No newline at end of file +import _bz2 \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/underscoresInNumericLiterals.py b/python/testData/inspections/PyCompatibilityInspection/underscoresInNumericLiterals.py index ea95bb230e3e..39a4d7ebb421 100644 --- a/python/testData/inspections/PyCompatibilityInspection/underscoresInNumericLiterals.py +++ b/python/testData/inspections/PyCompatibilityInspection/underscoresInNumericLiterals.py @@ -1,58 +1,58 @@ # hex -0xCAFE_F00D +0xCAFE_F00D # oct -0o1_23 -01_23 +0o1_23 +01_23 # bin -0b_0011_1111_0100_1110 +0b_0011_1111_0100_1110 # dec -10_000_000 +10_000_000 # pointfloat -10_00.00_23 -10_00. +10_00.00_23 +10_00. # exponentfloat -10_00.00_23e1_2 -10_00.00_23E1_2 -10_00.e1_2 -10_00.E1_2 +10_00.00_23e1_2 +10_00.00_23E1_2 +10_00.e1_2 +10_00.E1_2 -10_00.00_23e+1_2 -10_00.00_23E+1_2 -10_00.e+1_2 -10_00.E+1_2 +10_00.00_23e+1_2 +10_00.00_23E+1_2 +10_00.e+1_2 +10_00.E+1_2 -10_00.00_23e-1_2 -10_00.00_23E-1_2 -10_00.e-1_2 -10_00.E-1_2 +10_00.00_23e-1_2 +10_00.00_23E-1_2 +10_00.e-1_2 +10_00.E-1_2 -10_0000_23e1_2 -10_0000_23E1_2 -10_00e1_2 -10_00E1_2 +10_0000_23e1_2 +10_0000_23E1_2 +10_00e1_2 +10_00E1_2 -10_0000_23e+1_2 -10_0000_23E+1_2 -10_00e+1_2 -10_00E+1_2 +10_0000_23e+1_2 +10_0000_23E+1_2 +10_00e+1_2 +10_00E+1_2 -10_0000_23e-1_2 -10_0000_23E-1_2 -10_00e-1_2 -10_00E-1_2 +10_0000_23e-1_2 +10_0000_23E-1_2 +10_00e-1_2 +10_00E-1_2 # imag -10_00.00_23j -10_00.00_23J +10_00.00_23j +10_00.00_23J -10_00.00_23e1_2j -10_00.00_23e1_2J +10_00.00_23e1_2j +10_00.00_23e1_2J -10_000_000j -10_000_000J \ No newline at end of file +10_000_000j +10_000_000J \ No newline at end of file diff --git a/python/testData/inspections/PyCompatibilityInspection/variableAnnotations.py b/python/testData/inspections/PyCompatibilityInspection/variableAnnotations.py index e8372af1e7b8..13939af4e1e2 100644 --- a/python/testData/inspections/PyCompatibilityInspection/variableAnnotations.py +++ b/python/testData/inspections/PyCompatibilityInspection/variableAnnotations.py @@ -1,8 +1,8 @@ class C: - x: int - y: None = 42 + x: int + y: None = 42 def m(self, d): - x: List[bool] - d['foo']: str - (d['bar']): float + x: List[bool] + d['foo']: str + (d['bar']): float diff --git a/python/testData/inspections/PyCompatibilityInspection/withStatement.py b/python/testData/inspections/PyCompatibilityInspection/withStatement.py index 46bb73ae1869..67e5580f4301 100644 --- a/python/testData/inspections/PyCompatibilityInspection/withStatement.py +++ b/python/testData/inspections/PyCompatibilityInspection/withStatement.py @@ -1,2 +1,2 @@ -with A() as a, B() as b: +with A() as a, B() as b: suite diff --git a/python/testData/inspections/ReplaceNotEqOperator.py b/python/testData/inspections/ReplaceNotEqOperator.py index 250efb5cb76f..d4aaceb48173 100644 --- a/python/testData/inspections/ReplaceNotEqOperator.py +++ b/python/testData/inspections/ReplaceNotEqOperator.py @@ -1 +1 @@ -print(a <> b) \ No newline at end of file +print(a <> b) \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/python/Py3CompletionTest.java b/python/testSrc/com/jetbrains/python/Py3CompletionTest.java index 975e55b1bf55..c2c703c9f10b 100644 --- a/python/testSrc/com/jetbrains/python/Py3CompletionTest.java +++ b/python/testSrc/com/jetbrains/python/Py3CompletionTest.java @@ -150,7 +150,7 @@ public class Py3CompletionTest extends PyTestCase { // PY-17828 public void testDunderPrepare() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } // PY-20279 diff --git a/python/testSrc/com/jetbrains/python/Py3MethodOverridingInspectionTest.java b/python/testSrc/com/jetbrains/python/Py3MethodOverridingInspectionTest.java index 5871cc5150f8..c6e27880be02 100644 --- a/python/testSrc/com/jetbrains/python/Py3MethodOverridingInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/Py3MethodOverridingInspectionTest.java @@ -32,7 +32,7 @@ public class Py3MethodOverridingInspectionTest extends PyInspectionTestCase { // PY-17828 public void testDunderPrepare() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } @NotNull diff --git a/python/testSrc/com/jetbrains/python/Py3QuickFixTest.java b/python/testSrc/com/jetbrains/python/Py3QuickFixTest.java index 92cb9bfd56ae..e23d30f70e4a 100644 --- a/python/testSrc/com/jetbrains/python/Py3QuickFixTest.java +++ b/python/testSrc/com/jetbrains/python/Py3QuickFixTest.java @@ -56,31 +56,31 @@ public class Py3QuickFixTest extends PyTestCase { // PY-15867 public void testAddCallSuperKeywordOnlyParamInSuperInit() { - runWithLanguageLevel(LanguageLevel.PYTHON30, + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doInspectionTest(PyMissingConstructorInspection.class, PyBundle.message("QFIX.add.super"), true, true)); } // PY-15867 public void testAddCallSuperKeywordOnlyParamInInit() { - runWithLanguageLevel(LanguageLevel.PYTHON30, + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doInspectionTest(PyMissingConstructorInspection.class, PyBundle.message("QFIX.add.super"), true, true)); } // PY-15867 public void testAddCallSuperSingleStarParamInSuperInit() { - runWithLanguageLevel(LanguageLevel.PYTHON30, + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doInspectionTest(PyMissingConstructorInspection.class, PyBundle.message("QFIX.add.super"), true, true)); } // PY-15867 public void testAddCallSuperSingleStarParamInSuperInitAndVarargInInit() { - runWithLanguageLevel(LanguageLevel.PYTHON30, + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doInspectionTest(PyMissingConstructorInspection.class, PyBundle.message("QFIX.add.super"), true, true)); } // PY-11561 public void testAddCallSuperTypeAnnotationsPreserved() { - runWithLanguageLevel(LanguageLevel.PYTHON30, + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doInspectionTest(PyMissingConstructorInspection.class, PyBundle.message("QFIX.add.super"), true, true)); } @@ -91,25 +91,25 @@ public class Py3QuickFixTest extends PyTestCase { // PY-15867 public void testAddCallSuperNoRequiredKeywordOnlyParamAfterSingleStarInSuperInit() { - runWithLanguageLevel(LanguageLevel.PYTHON30, + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doInspectionTest(PyMissingConstructorInspection.class, PyBundle.message("QFIX.add.super"), true, true)); } // PY-16421 public void testAddCallSuperSingleStarParamPreserved() { - runWithLanguageLevel(LanguageLevel.PYTHON30, + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doInspectionTest(PyMissingConstructorInspection.class, PyBundle.message("QFIX.add.super"), true, true)); } // PY-15867 public void testAddCallSuperRequiredKeywordOnlyParamAfterSingleStarInSuperInitIsMerged() { - runWithLanguageLevel(LanguageLevel.PYTHON30, + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doInspectionTest(PyMissingConstructorInspection.class, PyBundle.message("QFIX.add.super"), true, true)); } // PY-16428 public void testAddParameterNotAvailableInsideAnnotation() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> doInspectionTest(PyUnresolvedReferencesInspection.class, + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doInspectionTest(PyUnresolvedReferencesInspection.class, PyBundle.message("QFIX.unresolved.reference.add.param.$0", "unresolved"), false, false)); } diff --git a/python/testSrc/com/jetbrains/python/Py3TypeTest.java b/python/testSrc/com/jetbrains/python/Py3TypeTest.java index 799c6af5cc3d..4a1127be5f0d 100644 --- a/python/testSrc/com/jetbrains/python/Py3TypeTest.java +++ b/python/testSrc/com/jetbrains/python/Py3TypeTest.java @@ -174,7 +174,7 @@ public class Py3TypeTest extends PyTestCase { // PY-16987 public void testNoTypeInGoogleDocstringParamAnnotation() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> doTest("int", "def f(x: int):\n" + + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doTest("int", "def f(x: int):\n" + " \"\"\"\n" + " Args:\n" + " x: foo\n" + @@ -184,7 +184,7 @@ public class Py3TypeTest extends PyTestCase { // PY-16987 public void testUnfilledTypeInGoogleDocstringParamAnnotation() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> doTest("int", "def f(x: int):\n" + + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doTest("int", "def f(x: int):\n" + " \"\"\"\n" + " Args:\n" + " x (): foo\n" + @@ -194,7 +194,7 @@ public class Py3TypeTest extends PyTestCase { // PY-16987 public void testNoTypeInNumpyDocstringParamAnnotation() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> doTest("int", "def f(x: int):\n" + + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doTest("int", "def f(x: int):\n" + " \"\"\"\n" + " Parameters\n" + " ----------\n" + @@ -206,7 +206,7 @@ public class Py3TypeTest extends PyTestCase { // PY-17010 public void testAnnotatedReturnTypePrecedesDocstring() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> doTest("int", "def func() -> int:\n" + + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doTest("int", "def func() -> int:\n" + " \"\"\"\n" + " Returns:\n" + " str\n" + @@ -216,7 +216,7 @@ public class Py3TypeTest extends PyTestCase { // PY-17010 public void testAnnotatedParamTypePrecedesDocstring() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> doTest("int", "def func(x: int):\n" + + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doTest("int", "def func(x: int):\n" + " \"\"\"\n" + " Args:\n" + " x (str):\n" + @@ -259,7 +259,7 @@ public class Py3TypeTest extends PyTestCase { // PY-1427 public void testBytesLiteral() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> doTest("bytes", "expr = b'foo'")); + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doTest("bytes", "expr = b'foo'")); } // PY-20770 diff --git a/python/testSrc/com/jetbrains/python/PyControlFlowBuilderTest.java b/python/testSrc/com/jetbrains/python/PyControlFlowBuilderTest.java index 252d04f3d40a..5cce49fdcd0a 100644 --- a/python/testSrc/com/jetbrains/python/PyControlFlowBuilderTest.java +++ b/python/testSrc/com/jetbrains/python/PyControlFlowBuilderTest.java @@ -171,7 +171,7 @@ public class PyControlFlowBuilderTest extends LightMarkedTestCase { } public void testTypeAnnotations() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } public void testQualifiedSelfReference() { diff --git a/python/testSrc/com/jetbrains/python/PyEditingTest.java b/python/testSrc/com/jetbrains/python/PyEditingTest.java index d7efb2165734..027c26c09731 100644 --- a/python/testSrc/com/jetbrains/python/PyEditingTest.java +++ b/python/testSrc/com/jetbrains/python/PyEditingTest.java @@ -429,7 +429,7 @@ public class PyEditingTest extends PyTestCase { // PY-15469 public void testEnterBeforeArrowInFunction() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> doTestEnter("def func() -> int:\n" + + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doTestEnter("def func() -> int:\n" + " pass", "def func() \\\n" + " -> int:\n" + @@ -438,7 +438,7 @@ public class PyEditingTest extends PyTestCase { // PY-15469 public void testEnterAfterArrowInFunction() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> doTestEnter("def func() -> int:\n" + + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doTestEnter("def func() -> int:\n" + " pass", "def func() ->\\\n" + " int:\n" + @@ -447,7 +447,7 @@ public class PyEditingTest extends PyTestCase { // PY-15469 public void testEnterDoesNotInsertSlashInsideArrow() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> doTestEnter("def func() -> int:\n" + + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doTestEnter("def func() -> int:\n" + " pass", "def func() -\n" + "> int:\n" + diff --git a/python/testSrc/com/jetbrains/python/PyFindUsagesTest.java b/python/testSrc/com/jetbrains/python/PyFindUsagesTest.java index e7a97b01efa3..f4f843ea6cb7 100644 --- a/python/testSrc/com/jetbrains/python/PyFindUsagesTest.java +++ b/python/testSrc/com/jetbrains/python/PyFindUsagesTest.java @@ -141,7 +141,7 @@ public class PyFindUsagesTest extends PyTestCase { // PY-8604 public void testOuterVariableInGeneratorPy3() { - runWithLanguageLevel(LanguageLevel.PYTHON30, + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> assertEquals(4, myFixture.testFindUsages("findUsages/OuterVariableInGenerator.py").size())); } @@ -153,7 +153,7 @@ public class PyFindUsagesTest extends PyTestCase { // PY-18808 public void testOuterVariableInListComprehensionPy3() { - runWithLanguageLevel(LanguageLevel.PYTHON30, + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> assertEquals(4, myFixture.testFindUsages("findUsages/OuterVariableInListComprehension.py").size())); } @@ -165,7 +165,7 @@ public class PyFindUsagesTest extends PyTestCase { } public void testOverrideVariableByTupleInComprehensionPy3() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> { + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> { assertEquals(1, myFixture.testFindUsages("findUsages/OverrideVariableByTupleInComprehension1.py").size()); assertEquals(2, myFixture.testFindUsages("findUsages/OverrideVariableByTupleInComprehension2.py").size()); }); @@ -179,7 +179,7 @@ public class PyFindUsagesTest extends PyTestCase { } public void testOverrideVariableInComprehensionPy3() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> { + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> { assertEquals(1, myFixture.testFindUsages("findUsages/OverrideVariableInComprehension1.py").size()); assertEquals(2, myFixture.testFindUsages("findUsages/OverrideVariableInComprehension2.py").size()); }); diff --git a/python/testSrc/com/jetbrains/python/PyFormatterTest.java b/python/testSrc/com/jetbrains/python/PyFormatterTest.java index 5086b9d7dab8..9b7a2e8db535 100644 --- a/python/testSrc/com/jetbrains/python/PyFormatterTest.java +++ b/python/testSrc/com/jetbrains/python/PyFormatterTest.java @@ -76,7 +76,7 @@ public class PyFormatterTest extends PyTestCase { } private void doTestPy3() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } public void testWrapTuple() { // PY-1792 @@ -246,7 +246,7 @@ public class PyFormatterTest extends PyTestCase { " desired_impulse_response = {'dirac, 'gaussian', logistic_derivative'}\n" + "return desired, o"; - final PsiFile file = PyElementGenerator.getInstance(myFixture.getProject()).createDummyFile(LanguageLevel.PYTHON30, initial); + final PsiFile file = PyElementGenerator.getInstance(myFixture.getProject()).createDummyFile(LanguageLevel.PYTHON34, initial); final PsiElement reformatted = CodeStyleManager.getInstance(myFixture.getProject()).reformat(file); String expected = @@ -785,7 +785,7 @@ public class PyFormatterTest extends PyTestCase { // PY-20970 public void testSpacesAfterNonlocal() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } // PY-21515 diff --git a/python/testSrc/com/jetbrains/python/PyIndentTest.java b/python/testSrc/com/jetbrains/python/PyIndentTest.java index fe531fc06477..9539f8f48632 100644 --- a/python/testSrc/com/jetbrains/python/PyIndentTest.java +++ b/python/testSrc/com/jetbrains/python/PyIndentTest.java @@ -358,7 +358,7 @@ public class PyIndentTest extends PyTestCase { // PY-24432 public void testUnindentAfterEllipsis() { runWithLanguageLevel( - LanguageLevel.PYTHON30, + LanguageLevel.PYTHON34, () -> doTest("def foo():\n" + " if True:\n" + diff --git a/python/testSrc/com/jetbrains/python/PyInjectionResolveTest.java b/python/testSrc/com/jetbrains/python/PyInjectionResolveTest.java index 8d5f8eb99f31..0257c09c3b16 100644 --- a/python/testSrc/com/jetbrains/python/PyInjectionResolveTest.java +++ b/python/testSrc/com/jetbrains/python/PyInjectionResolveTest.java @@ -96,17 +96,17 @@ public class PyInjectionResolveTest extends PyResolveTestCase { // PY-20863 public void testQuotedTypeReferenceInsideClass() { - assertResolvesTo(LanguageLevel.PYTHON30, PyClass.class, "MyClass"); + assertResolvesTo(LanguageLevel.PYTHON34, PyClass.class, "MyClass"); } // PY-20863 public void testQuotedTypeReferenceInsideFunction() { - assertResolvesTo(LanguageLevel.PYTHON30, PyClass.class, "MyClass"); + assertResolvesTo(LanguageLevel.PYTHON34, PyClass.class, "MyClass"); } // PY-20863 public void testQuotedTypeReferenceTopLevel() { - assertResolvesTo(LanguageLevel.PYTHON30, PyClass.class, "MyClass"); + assertResolvesTo(LanguageLevel.PYTHON34, PyClass.class, "MyClass"); } // PY-20377 diff --git a/python/testSrc/com/jetbrains/python/PyQuickDocTest.java b/python/testSrc/com/jetbrains/python/PyQuickDocTest.java index f2d4bd2619b1..aa4c982e8079 100644 --- a/python/testSrc/com/jetbrains/python/PyQuickDocTest.java +++ b/python/testSrc/com/jetbrains/python/PyQuickDocTest.java @@ -339,11 +339,11 @@ public class PyQuickDocTest extends LightMarkedTestCase { } public void testClassWithAllKindSuperClassExpressions() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::checkHTMLOnly); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::checkHTMLOnly); } public void testHoverOverClassWithAllKindSuperClassExpressions() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::checkHover); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::checkHover); } // PY-23247 diff --git a/python/testSrc/com/jetbrains/python/PyQuickFixTest.java b/python/testSrc/com/jetbrains/python/PyQuickFixTest.java index 779d88edbd54..b2ce731c8826 100644 --- a/python/testSrc/com/jetbrains/python/PyQuickFixTest.java +++ b/python/testSrc/com/jetbrains/python/PyQuickFixTest.java @@ -649,7 +649,7 @@ public class PyQuickFixTest extends PyTestCase { // PY-8174 public void testChangeSignatureAddKeywordOnlyParameter() { runWithLanguageLevel( - LanguageLevel.PYTHON30, + LanguageLevel.PYTHON34, () -> doInspectionTest(PyArgumentListInspection.class, "Change signature of func(x, *args, foo, bar)", true, true) ); } diff --git a/python/testSrc/com/jetbrains/python/PyRainbowHighlightingTest.java b/python/testSrc/com/jetbrains/python/PyRainbowHighlightingTest.java index 0ce9cfeba3a2..cf7c79acdc0f 100644 --- a/python/testSrc/com/jetbrains/python/PyRainbowHighlightingTest.java +++ b/python/testSrc/com/jetbrains/python/PyRainbowHighlightingTest.java @@ -90,7 +90,7 @@ public class PyRainbowHighlightingTest extends PyTestCase { public void testSameNameOuterAndNonLocalVariableAndItsReferenceHaveSameColors() { runWithLanguageLevel( - LanguageLevel.PYTHON30, + LanguageLevel.PYTHON34, () -> doTest("def outer():\n" + " another = None\n" + " another2 = None\n" + @@ -104,7 +104,7 @@ public class PyRainbowHighlightingTest extends PyTestCase { public void testSameNameOuterAndNonLocalVariableAndItsReferenceAfterReassignmentHaveSameColors() { runWithLanguageLevel( - LanguageLevel.PYTHON30, + LanguageLevel.PYTHON34, () -> doTest("def outer():\n" + " another = None\n" + " another2 = None\n" + diff --git a/python/testSrc/com/jetbrains/python/PyResolveTest.java b/python/testSrc/com/jetbrains/python/PyResolveTest.java index f5381b40dbe6..c25704d5ef14 100644 --- a/python/testSrc/com/jetbrains/python/PyResolveTest.java +++ b/python/testSrc/com/jetbrains/python/PyResolveTest.java @@ -286,7 +286,7 @@ public class PyResolveTest extends PyResolveTestCase { public void testSuperPy3k() { // PY-1330 runWithLanguageLevel( - LanguageLevel.PYTHON30, + LanguageLevel.PYTHON34, () -> { final PyFunction pyFunction = assertResolvesTo(PyFunction.class, "foo"); assertEquals("A", pyFunction.getContainingClass().getName()); @@ -398,11 +398,11 @@ public class PyResolveTest extends PyResolveTestCase { } public void testStarUnpacking() { // PY-1459 - assertResolvesTo(LanguageLevel.PYTHON30, PyTargetExpression.class, "heads"); + assertResolvesTo(LanguageLevel.PYTHON34, PyTargetExpression.class, "heads"); } public void testStarUnpackingInLoop() { // PY-1525 - assertResolvesTo(LanguageLevel.PYTHON30, PyTargetExpression.class, "bbb"); + assertResolvesTo(LanguageLevel.PYTHON34, PyTargetExpression.class, "bbb"); } public void testBuiltinVsClassMember() { // PY-1654 diff --git a/python/testSrc/com/jetbrains/python/PySmartEnterTest.java b/python/testSrc/com/jetbrains/python/PySmartEnterTest.java index e97751ed9a14..dd40c7d2b8d8 100644 --- a/python/testSrc/com/jetbrains/python/PySmartEnterTest.java +++ b/python/testSrc/com/jetbrains/python/PySmartEnterTest.java @@ -236,6 +236,6 @@ public class PySmartEnterTest extends PyTestCase { // PY-19279 public void testColonAfterReturnTypeAnnotation() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } } diff --git a/python/testSrc/com/jetbrains/python/PyStubsTest.java b/python/testSrc/com/jetbrains/python/PyStubsTest.java index faec86832a0d..dec09bd0138a 100644 --- a/python/testSrc/com/jetbrains/python/PyStubsTest.java +++ b/python/testSrc/com/jetbrains/python/PyStubsTest.java @@ -741,7 +741,7 @@ public class PyStubsTest extends PyTestCase { // PY-18116 public void testParameterAnnotation() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> { + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> { final PyFile file = getTestFile(); final PyFunction func = file.findTopLevelFunction("func"); final PyNamedParameter param = func.getParameterList().findParameterByName("x"); @@ -756,7 +756,7 @@ public class PyStubsTest extends PyTestCase { // PY-18116 public void testFunctionAnnotation() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> { + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> { final PyFile file = getTestFile(); final PyFunction func = file.findTopLevelFunction("func"); final String annotation = func.getAnnotationValue(); @@ -804,7 +804,7 @@ public class PyStubsTest extends PyTestCase { // PY-18116 public void testTypeAliasInParameterAnnotation() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> { + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> { final PyFile file = getTestFile(); final PyFunction func = file.findTopLevelFunction("func"); final PyNamedParameter param = func.getParameterList().findParameterByName("x"); @@ -838,7 +838,7 @@ public class PyStubsTest extends PyTestCase { // PY-18166 public void testUnresolvedTypingSymbol() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> { + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> { final PyFile file = getTestFile(); final PyFunction func = file.findTopLevelFunction("func"); assertType("() -> Any", func, TypeEvalContext.codeInsightFallback(file.getProject())); @@ -887,7 +887,7 @@ public class PyStubsTest extends PyTestCase { // PY-18816 public void testComplexGenericType() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> { + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> { myFixture.copyDirectoryToProject(getTestName(true), ""); final PsiManager manager = PsiManager.getInstance(myFixture.getProject()); final PyFile originFile = (PyFile)manager.findFile(myFixture.findFileInTempDir("a.py")); diff --git a/python/testSrc/com/jetbrains/python/PyTypeTest.java b/python/testSrc/com/jetbrains/python/PyTypeTest.java index 45774d9b6a66..d7ed25c9e814 100644 --- a/python/testSrc/com/jetbrains/python/PyTypeTest.java +++ b/python/testSrc/com/jetbrains/python/PyTypeTest.java @@ -182,7 +182,7 @@ public class PyTypeTest extends PyTestCase { public void testTypeAnno() { runWithLanguageLevel( - LanguageLevel.PYTHON30, + LanguageLevel.PYTHON34, () -> doTest("str", "def foo(x: str) -> list:\n" + " expr = x") @@ -191,7 +191,7 @@ public class PyTypeTest extends PyTestCase { public void testReturnTypeAnno() { runWithLanguageLevel( - LanguageLevel.PYTHON30, + LanguageLevel.PYTHON34, () -> doTest("list", "def foo(x) -> list:\n" + " return x\n" + @@ -2318,7 +2318,7 @@ public class PyTypeTest extends PyTestCase { // PY-24240 public void testImplicitSuper() { runWithLanguageLevel( - LanguageLevel.PYTHON30, + LanguageLevel.PYTHON34, () -> { final PyExpression expression = parseExpr("class A:\n" + " pass\n" + @@ -2350,7 +2350,7 @@ public class PyTypeTest extends PyTestCase { public void testNoneLiteral() { runWithLanguageLevel( - LanguageLevel.PYTHON30, + LanguageLevel.PYTHON34, () -> doTest("None", "expr = None") ); @@ -2358,7 +2358,7 @@ public class PyTypeTest extends PyTestCase { public void testEllipsis() { runWithLanguageLevel( - LanguageLevel.PYTHON30, + LanguageLevel.PYTHON34, () -> doTest("Any", "expr = ...") ); diff --git a/python/testSrc/com/jetbrains/python/PythonHighlightingLexerTest.java b/python/testSrc/com/jetbrains/python/PythonHighlightingLexerTest.java index c32465f1fa31..62c43fef46b2 100644 --- a/python/testSrc/com/jetbrains/python/PythonHighlightingLexerTest.java +++ b/python/testSrc/com/jetbrains/python/PythonHighlightingLexerTest.java @@ -74,7 +74,7 @@ public class PythonHighlightingLexerTest extends PyLexerTestCase { } public void testBytes30() { - doTest(LanguageLevel.PYTHON30, "s = b\"some string\"", + doTest(LanguageLevel.PYTHON34, "s = b\"some string\"", "Py:IDENTIFIER", "Py:SPACE", "Py:EQ", "Py:SPACE", "Py:SINGLE_QUOTED_STRING"); } @@ -127,7 +127,7 @@ public class PythonHighlightingLexerTest extends PyLexerTestCase { } public void testUnicode30() { - doTest(LanguageLevel.PYTHON30, "s = \"some string\"", + doTest(LanguageLevel.PYTHON34, "s = \"some string\"", "Py:IDENTIFIER", "Py:SPACE", "Py:EQ", "Py:SPACE", "Py:SINGLE_QUOTED_UNICODE"); } diff --git a/python/testSrc/com/jetbrains/python/PythonHighlightingTest.java b/python/testSrc/com/jetbrains/python/PythonHighlightingTest.java index 8bf400c16a1a..c1097539443e 100644 --- a/python/testSrc/com/jetbrains/python/PythonHighlightingTest.java +++ b/python/testSrc/com/jetbrains/python/PythonHighlightingTest.java @@ -65,7 +65,7 @@ public class PythonHighlightingTest extends PyTestCase { } public void testAssignmentTargets3K() { - doTest(LanguageLevel.PYTHON30, true, false); + doTest(LanguageLevel.PYTHON34, true, false); } public void testBreakOutsideOfLoop() { @@ -128,11 +128,11 @@ public class PythonHighlightingTest extends PyTestCase { } public void testRegularAfterVarArgs() { - doTest(LanguageLevel.PYTHON30, true, false); + doTest(LanguageLevel.PYTHON34, true, false); } public void testKeywordOnlyArguments() { - doTest(LanguageLevel.PYTHON30, true, false); + doTest(LanguageLevel.PYTHON34, true, false); } public void testMalformedStringTripleQuoteUnterminated() { @@ -156,7 +156,7 @@ public class PythonHighlightingTest extends PyTestCase { } public void testUnsupportedFeaturesInPython3() { - doTest(LanguageLevel.PYTHON30, true, false); + doTest(LanguageLevel.PYTHON34, true, false); } // PY-6703 @@ -373,7 +373,7 @@ public class PythonHighlightingTest extends PyTestCase { // PY-22729 public void testParametersWithAnnotationsAndDefaults() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } // PY-26491 diff --git a/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java b/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java index 05fa901b473b..99b02cb694ac 100644 --- a/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java +++ b/python/testSrc/com/jetbrains/python/PythonInspectionsTest.java @@ -24,7 +24,7 @@ public class PythonInspectionsTest extends PyTestCase { } private void doTestWithPy3k(String testName, LocalInspectionTool localInspectionTool) { - doTestWithLanguageLevel(testName, localInspectionTool, LanguageLevel.PYTHON30); + doTestWithLanguageLevel(testName, localInspectionTool, LanguageLevel.PYTHON34); } private void doTestWithLanguageLevel(String testName, diff --git a/python/testSrc/com/jetbrains/python/PythonKeywordCompletionTest.java b/python/testSrc/com/jetbrains/python/PythonKeywordCompletionTest.java index 40d76105637d..da6a5d8a6c8f 100644 --- a/python/testSrc/com/jetbrains/python/PythonKeywordCompletionTest.java +++ b/python/testSrc/com/jetbrains/python/PythonKeywordCompletionTest.java @@ -10,7 +10,7 @@ import java.util.List; public class PythonKeywordCompletionTest extends PyTestCase { private void doTest3K() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } private void doTest() { diff --git a/python/testSrc/com/jetbrains/python/PythonParsingTest.java b/python/testSrc/com/jetbrains/python/PythonParsingTest.java index 950643cc20c1..4d49baa362f0 100644 --- a/python/testSrc/com/jetbrains/python/PythonParsingTest.java +++ b/python/testSrc/com/jetbrains/python/PythonParsingTest.java @@ -140,11 +140,11 @@ public class PythonParsingTest extends ParsingTestCase { } public void testKeywordOnlyArgument() { // PEP 3102 - doTest(LanguageLevel.PYTHON30); + doTest(LanguageLevel.PYTHON34); } public void testPy3KKeywords() { - doTest(LanguageLevel.PYTHON30); + doTest(LanguageLevel.PYTHON34); } public void testExecPy2() { @@ -152,11 +152,11 @@ public class PythonParsingTest extends ParsingTestCase { } public void testExecPy3() { - doTest(LanguageLevel.PYTHON30); + doTest(LanguageLevel.PYTHON34); } public void testSuperclassKeywordArguments() { - doTest(LanguageLevel.PYTHON30); + doTest(LanguageLevel.PYTHON34); } public void testDictLiteral() { @@ -164,19 +164,19 @@ public class PythonParsingTest extends ParsingTestCase { } public void testSetLiteral() { - doTest(LanguageLevel.PYTHON30); + doTest(LanguageLevel.PYTHON34); } public void testSetComprehension() { - doTest(LanguageLevel.PYTHON30); + doTest(LanguageLevel.PYTHON34); } public void testDictComprehension() { - doTest(LanguageLevel.PYTHON30); + doTest(LanguageLevel.PYTHON34); } public void testRaiseFrom() { - doTest(LanguageLevel.PYTHON30); + doTest(LanguageLevel.PYTHON34); } public void testEllipsis() { @@ -196,11 +196,11 @@ public class PythonParsingTest extends ParsingTestCase { } public void testAnnotations() { - doTest(LanguageLevel.PYTHON30); + doTest(LanguageLevel.PYTHON34); } public void testNonlocal() { - doTest(LanguageLevel.PYTHON30); + doTest(LanguageLevel.PYTHON34); } public void testFloorDiv() { @@ -220,7 +220,7 @@ public class PythonParsingTest extends ParsingTestCase { } public void testStarExpression() { // PEP-3132 - doTest(LanguageLevel.PYTHON30); + doTest(LanguageLevel.PYTHON34); } public void testDictMissingComma() { // PY-1025 @@ -348,7 +348,7 @@ public class PythonParsingTest extends ParsingTestCase { // PY-6734 public void testRaiseFromNoExpr() { - doTest(LanguageLevel.PYTHON30); + doTest(LanguageLevel.PYTHON34); } // PY-6781 diff --git a/python/testSrc/com/jetbrains/python/codeInsight/PyClassMROTest.java b/python/testSrc/com/jetbrains/python/codeInsight/PyClassMROTest.java index f308c617eb9e..45dcd0f709b3 100644 --- a/python/testSrc/com/jetbrains/python/codeInsight/PyClassMROTest.java +++ b/python/testSrc/com/jetbrains/python/codeInsight/PyClassMROTest.java @@ -155,7 +155,7 @@ public class PyClassMROTest extends PyTestCase { // PY-20026 public void testUnresolvedMetaClassAncestors() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> { + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> { final PyClass pyClass = getClass("CompositeFieldMeta"); assertMRO(pyClass, "object"); assertMetaClass(pyClass, "type"); diff --git a/python/testSrc/com/jetbrains/python/inspections/PyAbstractClassInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyAbstractClassInspectionTest.java index b8779dc6c845..b6d3e6ce860d 100644 --- a/python/testSrc/com/jetbrains/python/inspections/PyAbstractClassInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/PyAbstractClassInspectionTest.java @@ -26,7 +26,7 @@ public class PyAbstractClassInspectionTest extends PyInspectionTestCase { // PY-16035 public void testHiddenForAbstractSubclassWithExplicitMetaclassPy3() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> doTest()); + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doTest()); } // PY-16035 diff --git a/python/testSrc/com/jetbrains/python/inspections/PyArgumentListInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyArgumentListInspectionTest.java index 71831e83fba9..5d63f2ae2e27 100644 --- a/python/testSrc/com/jetbrains/python/inspections/PyArgumentListInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/PyArgumentListInspectionTest.java @@ -22,7 +22,7 @@ public class PyArgumentListInspectionTest extends PyInspectionTestCase { } public void testDecoratorsPy3K() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } // PY-19130 @@ -66,7 +66,7 @@ public class PyArgumentListInspectionTest extends PyInspectionTestCase { } public void testPy1268() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } public void testInstanceMethodAsLambda() { @@ -141,7 +141,7 @@ public class PyArgumentListInspectionTest extends PyInspectionTestCase { } public void testPy3k() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } @NotNull @@ -316,7 +316,7 @@ public class PyArgumentListInspectionTest extends PyInspectionTestCase { // PY-26023 public void testAbstractMethod() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } // PY-27148 diff --git a/python/testSrc/com/jetbrains/python/inspections/PyClassHasNoInitInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyClassHasNoInitInspectionTest.java index de6b669bef4f..9c7789e5262b 100644 --- a/python/testSrc/com/jetbrains/python/inspections/PyClassHasNoInitInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/PyClassHasNoInitInspectionTest.java @@ -55,7 +55,7 @@ public class PyClassHasNoInitInspectionTest extends PyInspectionTestCase { // PY-24436 public void testAInheritsBAndBInheritsImportedAWithDunderInit() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doMultiFileTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doMultiFileTest); } @NotNull diff --git a/python/testSrc/com/jetbrains/python/inspections/PyCompatibilityInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyCompatibilityInspectionTest.java index c8ccc1168695..6319cec2ead5 100644 --- a/python/testSrc/com/jetbrains/python/inspections/PyCompatibilityInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/PyCompatibilityInspectionTest.java @@ -83,7 +83,7 @@ public class PyCompatibilityInspectionTest extends PyInspectionTestCase { } public void testCallExpression() { - doTest(LanguageLevel.PYTHON30); + doTest(LanguageLevel.PYTHON34); } public void testBasestring() { @@ -194,7 +194,7 @@ public class PyCompatibilityInspectionTest extends PyInspectionTestCase { // PY-26510 public void testTryFinallyEmptyRaisePy3() { - doTest(LanguageLevel.PYTHON30); + doTest(LanguageLevel.PYTHON34); } private void doTest(@NotNull LanguageLevel level) { diff --git a/python/testSrc/com/jetbrains/python/inspections/PyDunderSlotsInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyDunderSlotsInspectionTest.java index b9fed122fa0e..2b1946ab867d 100644 --- a/python/testSrc/com/jetbrains/python/inspections/PyDunderSlotsInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/PyDunderSlotsInspectionTest.java @@ -244,7 +244,7 @@ public class PyDunderSlotsInspectionTest extends PyInspectionTestCase { } private void doTestPy3() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } @NotNull diff --git a/python/testSrc/com/jetbrains/python/inspections/PyMethodMayBeStaticInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyMethodMayBeStaticInspectionTest.java index 713079c52226..2e18b2ccd912 100644 --- a/python/testSrc/com/jetbrains/python/inspections/PyMethodMayBeStaticInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/PyMethodMayBeStaticInspectionTest.java @@ -100,12 +100,12 @@ public class PyMethodMayBeStaticInspectionTest extends PyInspectionTestCase { // PY-18866 public void testSuperSamePy3() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> doTest()); + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doTest()); } // PY-18866 public void testSuperNotSamePy3() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> doTest()); + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doTest()); } // PY-24817 diff --git a/python/testSrc/com/jetbrains/python/inspections/PyMissingConstructorTest.java b/python/testSrc/com/jetbrains/python/inspections/PyMissingConstructorTest.java index 468437e305a1..761a9cb183b1 100644 --- a/python/testSrc/com/jetbrains/python/inspections/PyMissingConstructorTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/PyMissingConstructorTest.java @@ -55,7 +55,7 @@ public class PyMissingConstructorTest extends PyTestCase { // PY-20038 public void testImplicitDunderClass() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } // PY-7176 @@ -69,7 +69,7 @@ public class PyMissingConstructorTest extends PyTestCase { } public void testPy3k() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } private void doTest() { diff --git a/python/testSrc/com/jetbrains/python/inspections/PyOldStyleClassInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyOldStyleClassInspectionTest.java index 1c3cafd7541b..5f79a55bc8a2 100644 --- a/python/testSrc/com/jetbrains/python/inspections/PyOldStyleClassInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/PyOldStyleClassInspectionTest.java @@ -37,7 +37,7 @@ public class PyOldStyleClassInspectionTest extends PyInspectionTestCase { } public void testSuper30() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } @NotNull diff --git a/python/testSrc/com/jetbrains/python/inspections/PyTupleAssignmentBalanceInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyTupleAssignmentBalanceInspectionTest.java index 7baee5095d55..0851a5a57aaf 100644 --- a/python/testSrc/com/jetbrains/python/inspections/PyTupleAssignmentBalanceInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/PyTupleAssignmentBalanceInspectionTest.java @@ -26,7 +26,7 @@ public class PyTupleAssignmentBalanceInspectionTest extends PyInspectionTestCase } public void testPy3() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } // PY-4357 @@ -56,7 +56,7 @@ public class PyTupleAssignmentBalanceInspectionTest extends PyInspectionTestCase // PY-22224 public void testUnpackNonePy3() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } @NotNull diff --git a/python/testSrc/com/jetbrains/python/inspections/PyTypeCheckerInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyTypeCheckerInspectionTest.java index 669421673762..7354ff89741c 100644 --- a/python/testSrc/com/jetbrains/python/inspections/PyTypeCheckerInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/PyTypeCheckerInspectionTest.java @@ -449,7 +449,7 @@ public class PyTypeCheckerInspectionTest extends PyInspectionTestCase { // PY-21408 public void testClassMetaAttrsAgainstStructural() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } public void testCallableInstanceAgainstCallable() { diff --git a/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java index 0f963bb0df9f..557500184194 100644 --- a/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java @@ -532,7 +532,7 @@ public class PyUnresolvedReferencesInspectionTest extends PyInspectionTestCase { // PY-18521 public void testFunctionTypeCommentUsesImportsFromTyping() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } // PY-22620 @@ -588,7 +588,7 @@ public class PyUnresolvedReferencesInspectionTest extends PyInspectionTestCase { // PY-23540 public void testMemberFromMetaclassWhenSuperclassMetaclassIsABCMeta() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } // PY-23623 diff --git a/python/testSrc/com/jetbrains/python/inspections/PyUnusedLocalInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyUnusedLocalInspectionTest.java index 87ff84883744..2a912b8ee335 100644 --- a/python/testSrc/com/jetbrains/python/inspections/PyUnusedLocalInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/PyUnusedLocalInspectionTest.java @@ -29,7 +29,7 @@ public class PyUnusedLocalInspectionTest extends PyInspectionTestCase { } public void testNonlocal() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } // PY-1235 diff --git a/python/testSrc/com/jetbrains/python/intentions/PyAnnotateTypesIntentionTest.java b/python/testSrc/com/jetbrains/python/intentions/PyAnnotateTypesIntentionTest.java index 318082cd806d..ac012a0e152d 100644 --- a/python/testSrc/com/jetbrains/python/intentions/PyAnnotateTypesIntentionTest.java +++ b/python/testSrc/com/jetbrains/python/intentions/PyAnnotateTypesIntentionTest.java @@ -18,7 +18,7 @@ public class PyAnnotateTypesIntentionTest extends PyIntentionTestCase { public void testCaretOnImportedInvocation() { runWithLanguageLevel( - LanguageLevel.PYTHON30, + LanguageLevel.PYTHON34, () -> { doIntentionTest(PyBundle.message("INTN.annotate.types"), getTestName(true) + ".py", "foo_decl.py"); myFixture.checkResultByFile("foo_decl.py", "foo_decl_after.py", false); @@ -31,6 +31,6 @@ public class PyAnnotateTypesIntentionTest extends PyIntentionTestCase { } private void doTest() { - doTest(PyBundle.message("INTN.annotate.types"), LanguageLevel.PYTHON30); + doTest(PyBundle.message("INTN.annotate.types"), LanguageLevel.PYTHON34); } } diff --git a/python/testSrc/com/jetbrains/python/intentions/PyIntentionTest.java b/python/testSrc/com/jetbrains/python/intentions/PyIntentionTest.java index ad663e56a39f..7becf24f990c 100644 --- a/python/testSrc/com/jetbrains/python/intentions/PyIntentionTest.java +++ b/python/testSrc/com/jetbrains/python/intentions/PyIntentionTest.java @@ -73,15 +73,11 @@ public class PyIntentionTest extends PyTestCase { } public void testReplaceExceptPart() { - doTest(PyBundle.message("INTN.convert.except.to"), LanguageLevel.PYTHON30); + doTest(PyBundle.message("INTN.convert.except.to"), LanguageLevel.PYTHON34); } public void testConvertBuiltins() { - doTest(PyBundle.message("INTN.convert.builtin.import"), LanguageLevel.PYTHON30); - } - - public void testRemoveLeadingU() { - doTest(PyBundle.message("INTN.remove.leading.$0", "U"), LanguageLevel.PYTHON30); + doTest(PyBundle.message("INTN.convert.builtin.import"), LanguageLevel.PYTHON34); } public void testRemoveLeadingF() { @@ -90,23 +86,23 @@ public class PyIntentionTest extends PyTestCase { // PY-18972 public void testRemoveTrailingL() { - doTest(PyBundle.message("INTN.remove.trailing.l"), LanguageLevel.PYTHON30); + doTest(PyBundle.message("INTN.remove.trailing.l"), LanguageLevel.PYTHON34); } public void testReplaceOctalNumericLiteral() { - doTest(PyBundle.message("INTN.replace.octal.numeric.literal"), LanguageLevel.PYTHON30); + doTest(PyBundle.message("INTN.replace.octal.numeric.literal"), LanguageLevel.PYTHON34); } public void testReplaceListComprehensions() { - doTest(PyBundle.message("INTN.replace.list.comprehensions"), LanguageLevel.PYTHON30); + doTest(PyBundle.message("INTN.replace.list.comprehensions"), LanguageLevel.PYTHON34); } public void testReplaceRaiseStatement() { - doTest(PyBundle.message("INTN.replace.raise.statement"), LanguageLevel.PYTHON30); + doTest(PyBundle.message("INTN.replace.raise.statement"), LanguageLevel.PYTHON34); } public void testReplaceBackQuoteExpression() { - doTest(PyBundle.message("INTN.replace.backquote.expression"), LanguageLevel.PYTHON30); + doTest(PyBundle.message("INTN.replace.backquote.expression"), LanguageLevel.PYTHON34); } /* @@ -236,7 +232,7 @@ public class PyIntentionTest extends PyTestCase { } public void testConvertVariadicParamPositionalContainerInPy3() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> doTest(PyBundle.message("INTN.convert.variadic.param"))); + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doTest(PyBundle.message("INTN.convert.variadic.param"))); } // PY-26284 diff --git a/python/testSrc/com/jetbrains/python/intentions/SpecifyTypeInPy3AnnotationsIntentionTest.java b/python/testSrc/com/jetbrains/python/intentions/SpecifyTypeInPy3AnnotationsIntentionTest.java index c5420291769a..94bbc7f82ffb 100644 --- a/python/testSrc/com/jetbrains/python/intentions/SpecifyTypeInPy3AnnotationsIntentionTest.java +++ b/python/testSrc/com/jetbrains/python/intentions/SpecifyTypeInPy3AnnotationsIntentionTest.java @@ -20,7 +20,7 @@ public class SpecifyTypeInPy3AnnotationsIntentionTest extends PyIntentionTestCas public void testCaretOnImportedInvocation() { runWithLanguageLevel( - LanguageLevel.PYTHON30, + LanguageLevel.PYTHON34, () -> { doIntentionTest(PyBundle.message("INTN.specify.return.type.in.annotation"), getTestName(true) + ".py", "foo_decl.py"); myFixture.checkResultByFile("foo_decl.py", "foo_decl_after.py", false); @@ -34,11 +34,11 @@ public class SpecifyTypeInPy3AnnotationsIntentionTest extends PyIntentionTestCas private void doTestReturnType() { - doTest(PyBundle.message("INTN.specify.return.type.in.annotation"), LanguageLevel.PYTHON30); + doTest(PyBundle.message("INTN.specify.return.type.in.annotation"), LanguageLevel.PYTHON34); } private void doTestParam() { - doTest(PyBundle.message("INTN.specify.type.in.annotation"), LanguageLevel.PYTHON30); + doTest(PyBundle.message("INTN.specify.type.in.annotation"), LanguageLevel.PYTHON34); } } diff --git a/python/testSrc/com/jetbrains/python/packaging/PyPackageUtilTest.java b/python/testSrc/com/jetbrains/python/packaging/PyPackageUtilTest.java index aa71ad8cb245..25793d43017e 100644 --- a/python/testSrc/com/jetbrains/python/packaging/PyPackageUtilTest.java +++ b/python/testSrc/com/jetbrains/python/packaging/PyPackageUtilTest.java @@ -99,7 +99,7 @@ public class PyPackageUtilTest extends PyTestCase { checkRequirements(PyPackageUtil.getRequirementsFromTxt(module), 1); WriteCommandAction.runWriteCommandAction(myFixture.getProject(), - () -> PyPackageUtil.addRequirementToTxtOrSetupPy(module, "Markdown", LanguageLevel.PYTHON30)); + () -> PyPackageUtil.addRequirementToTxtOrSetupPy(module, "Markdown", LanguageLevel.PYTHON34)); checkRequirements(PyPackageUtil.getRequirementsFromTxt(module)); } @@ -173,7 +173,7 @@ public class PyPackageUtilTest extends PyTestCase { assertNull(isRequirementsTxt ? PyPackageUtil.getRequirementsFromTxt(module) : PyPackageUtil.findSetupPyRequires(module)); WriteCommandAction.runWriteCommandAction(myFixture.getProject(), - () -> PyPackageUtil.addRequirementToTxtOrSetupPy(module, "Markdown", LanguageLevel.PYTHON30)); + () -> PyPackageUtil.addRequirementToTxtOrSetupPy(module, "Markdown", LanguageLevel.PYTHON34)); assertNull(isRequirementsTxt ? PyPackageUtil.getRequirementsFromTxt(module) : PyPackageUtil.findSetupPyRequires(module)); } @@ -193,13 +193,13 @@ public class PyPackageUtilTest extends PyTestCase { checkSetupArgumentText(module, keyword, null); checkRequirements(PyPackageUtil.findSetupPyRequires(module), 2); - final Runnable introduceRequires = () -> PyPackageUtil.addRequirementToTxtOrSetupPy(module, "NewDjango==1.3.1", LanguageLevel.PYTHON30); + final Runnable introduceRequires = () -> PyPackageUtil.addRequirementToTxtOrSetupPy(module, "NewDjango==1.3.1", LanguageLevel.PYTHON34); WriteCommandAction.runWriteCommandAction(myFixture.getProject(), introduceRequires); checkSetupArgumentText(module, keyword, "['NewDjango==1.3.1']"); checkRequirements(PyPackageUtil.findSetupPyRequires(module), 1); - final Runnable updateRequires = () -> PyPackageUtil.addRequirementToTxtOrSetupPy(module, "Markdown", LanguageLevel.PYTHON30); + final Runnable updateRequires = () -> PyPackageUtil.addRequirementToTxtOrSetupPy(module, "Markdown", LanguageLevel.PYTHON34); WriteCommandAction.runWriteCommandAction(myFixture.getProject(), updateRequires); checkSetupArgumentText(module, keyword, "['NewDjango==1.3.1', 'Markdown']"); diff --git a/python/testSrc/com/jetbrains/python/quickFixes/PyMakeFunctionReturnTypeQuickFixTest.java b/python/testSrc/com/jetbrains/python/quickFixes/PyMakeFunctionReturnTypeQuickFixTest.java index ec8fc327f5c2..5ad94e973c15 100644 --- a/python/testSrc/com/jetbrains/python/quickFixes/PyMakeFunctionReturnTypeQuickFixTest.java +++ b/python/testSrc/com/jetbrains/python/quickFixes/PyMakeFunctionReturnTypeQuickFixTest.java @@ -31,6 +31,6 @@ public class PyMakeFunctionReturnTypeQuickFixTest extends PyQuickFixTestCase { } public void testPy3OneReturn() { - doQuickFixTest(PyTypeCheckerInspection.class, PyBundle.message("QFIX.NAME.make.$0.return.$1", "f", "int"), LanguageLevel.PYTHON30); + doQuickFixTest(PyTypeCheckerInspection.class, PyBundle.message("QFIX.NAME.make.$0.return.$1", "f", "int"), LanguageLevel.PYTHON34); } } diff --git a/python/testSrc/com/jetbrains/python/refactoring/PyExtractMethodTest.java b/python/testSrc/com/jetbrains/python/refactoring/PyExtractMethodTest.java index b1c9c60c21a1..a825af6704a5 100644 --- a/python/testSrc/com/jetbrains/python/refactoring/PyExtractMethodTest.java +++ b/python/testSrc/com/jetbrains/python/refactoring/PyExtractMethodTest.java @@ -211,7 +211,7 @@ public class PyExtractMethodTest extends LightMarkedTestCase { // PY-6625 public void testNonlocal() { - doTest("baz", LanguageLevel.PYTHON30); + doTest("baz", LanguageLevel.PYTHON34); } // PY-7381 diff --git a/python/testSrc/com/jetbrains/python/refactoring/PyIntroduceConstantTest.java b/python/testSrc/com/jetbrains/python/refactoring/PyIntroduceConstantTest.java index 4991fc743b26..5c7fc89f6f34 100644 --- a/python/testSrc/com/jetbrains/python/refactoring/PyIntroduceConstantTest.java +++ b/python/testSrc/com/jetbrains/python/refactoring/PyIntroduceConstantTest.java @@ -17,7 +17,7 @@ public class PyIntroduceConstantTest extends PyIntroduceTestCase { } public void testPy1840EntireLine() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest); } public void testInsertAfterImport() { // PY-2149 diff --git a/python/testSrc/com/jetbrains/python/refactoring/PyMakeFunctionTopLevelTest.java b/python/testSrc/com/jetbrains/python/refactoring/PyMakeFunctionTopLevelTest.java index 41709fe7bf0b..0553b14f9987 100644 --- a/python/testSrc/com/jetbrains/python/refactoring/PyMakeFunctionTopLevelTest.java +++ b/python/testSrc/com/jetbrains/python/refactoring/PyMakeFunctionTopLevelTest.java @@ -173,13 +173,13 @@ public class PyMakeFunctionTopLevelTest extends PyTestCase { // PY-6637 public void testLocalFunctionNonlocalReferenceToOuterScope() { - runWithLanguageLevel(LanguageLevel.PYTHON30, + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doTestFailure(PyBundle.message("refactoring.make.function.top.level.error.nonlocal.writes"))); } // PY-6637 public void testLocalFunctionNonlocalReferencesInInnerFunction() { - runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTestSuccess); + runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTestSuccess); } // PY-6637 @@ -188,7 +188,7 @@ public class PyMakeFunctionTopLevelTest extends PyTestCase { } public void testMethodNonlocalReferenceToOuterScope() { - runWithLanguageLevel(LanguageLevel.PYTHON30, + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doTestFailure(PyBundle.message("refactoring.make.function.top.level.error.nonlocal.writes"))); } diff --git a/python/testSrc/com/jetbrains/python/refactoring/PyMoveTest.java b/python/testSrc/com/jetbrains/python/refactoring/PyMoveTest.java index 2db733c9c84f..8cf22a9cb9b3 100644 --- a/python/testSrc/com/jetbrains/python/refactoring/PyMoveTest.java +++ b/python/testSrc/com/jetbrains/python/refactoring/PyMoveTest.java @@ -76,7 +76,7 @@ public class PyMoveTest extends PyTestCase { // PY-11923 public void testMovableTopLevelAssignmentDetection() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> { + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> { myFixture.configureByFile("/refactoring/move/" + getTestName(true) + ".py"); assertFalse(isMovableModuleMember(findFirstNamedElement("X1"))); assertFalse(isMovableModuleMember(findFirstNamedElement("X3"))); diff --git a/python/testSrc/com/jetbrains/python/refactoring/changeSignature/PyChangeSignatureTest.java b/python/testSrc/com/jetbrains/python/refactoring/changeSignature/PyChangeSignatureTest.java index e11ccf9624e2..26c563cf0a37 100644 --- a/python/testSrc/com/jetbrains/python/refactoring/changeSignature/PyChangeSignatureTest.java +++ b/python/testSrc/com/jetbrains/python/refactoring/changeSignature/PyChangeSignatureTest.java @@ -219,7 +219,7 @@ public class PyChangeSignatureTest extends PyTestCase { // PY-14774 public void testAnnotationsForStarredParametersAreNotShownInDialog() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> { + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> { myFixture.configureByText(PythonFileType.INSTANCE, "def func(a, b:int, *args: tuple, c:list, d:str='foo', ** kwargs:dict):\n" + " pass"); final PyFunction function = (PyFunction)new PyChangeSignatureHandler().findTargetMember(myFixture.getFile(), myFixture.getEditor()); @@ -312,11 +312,17 @@ public class PyChangeSignatureTest extends PyTestCase { // PY-16683 public void testKeywordOnlyParameter() { - runWithLanguageLevel(LanguageLevel.PYTHON30, () -> { - doChangeSignatureTest(null, Arrays.asList(new PyParameterInfo(0, "x", null, false), - new PyParameterInfo(1, "*args", null, false), - new PyParameterInfo(-1, "foo", "None", false))); - }); + runWithLanguageLevel( + LanguageLevel.PYTHON34, + () -> + doChangeSignatureTest(null, + Arrays.asList( + new PyParameterInfo(0, "x", null, false), + new PyParameterInfo(1, "*args", null, false), + new PyParameterInfo(-1, "foo", "None", false) + ) + ) + ); } // PY-24602 diff --git a/python/testSrc/com/jetbrains/python/refactoring/classes/extractSuperclass/PyExtractSuperclassTest.java b/python/testSrc/com/jetbrains/python/refactoring/classes/extractSuperclass/PyExtractSuperclassTest.java index 29363da18a58..bd1c0a2beb25 100644 --- a/python/testSrc/com/jetbrains/python/refactoring/classes/extractSuperclass/PyExtractSuperclassTest.java +++ b/python/testSrc/com/jetbrains/python/refactoring/classes/extractSuperclass/PyExtractSuperclassTest.java @@ -32,7 +32,7 @@ public class PyExtractSuperclassTest extends PyClassRefactoringTest { // Checks if class explicitly extends object we shall move it even in Py3K (PY-19137) public void testPy3ParentHasObject() { - runWithLanguageLevel(LanguageLevel.PYTHON30, + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> doSimpleTest("Child", "Parent", null, true, false, ".spam")); } @@ -64,7 +64,7 @@ public class PyExtractSuperclassTest extends PyClassRefactoringTest { // Extracts method as abstract and ensures that newly created class imports ABC in Py3 public void testMoveAndMakeAbstractImportExistsPy3() { runWithLanguageLevel( - LanguageLevel.PYTHON30, + LanguageLevel.PYTHON34, () -> { configureMultiFile("abc"); multiFileTestHelper(".foo_method", true); diff --git a/python/testSrc/com/jetbrains/python/refactoring/classes/pullUp/PyPullUpPresenterTest.java b/python/testSrc/com/jetbrains/python/refactoring/classes/pullUp/PyPullUpPresenterTest.java index 48a76a54ead1..7c409a285df9 100644 --- a/python/testSrc/com/jetbrains/python/refactoring/classes/pullUp/PyPullUpPresenterTest.java +++ b/python/testSrc/com/jetbrains/python/refactoring/classes/pullUp/PyPullUpPresenterTest.java @@ -121,7 +121,7 @@ public class PyPullUpPresenterTest extends PyRefactoringPresenterTestCase ensureCorrectMembersForHugeChild(true)); + runWithLanguageLevel(LanguageLevel.PYTHON34, () -> ensureCorrectMembersForHugeChild(true)); } /**