PY-16412 Don't suggest the intention for targets that doesn't allow annotations

This commit is contained in:
Mikhail Golubev
2018-02-05 21:41:59 +03:00
committed by Andrey Vlasovskikh
parent 95227c365b
commit fc3d1b7beb
9 changed files with 66 additions and 3 deletions
@@ -9,6 +9,35 @@ import org.jetbrains.annotations.NotNull;
* @author Mikhail Golubev
*/
public class PyAnnotateVariableTypeIntentionTest extends PyIntentionTestCase {
public void testNotSuggestedForLocalAssignmentTargetWithAnnotation() {
doNegativeTest();
}
public void testNotSuggestedForLocalAssignmentTargetWithAheadOfTimeAnnotation() {
doNegativeTest();
}
public void testNotSuggestedForLocalAssignmentTargetWithTypeComment() {
doNegativeTest();
}
public void testNotSuggestedForComprehensionTarget() {
doNegativeTest();
}
public void testNotSuggestedForImportTarget() {
doNegativeTest();
}
public void testNotSuggestedForGlobalTarget() {
doNegativeTest();
}
public void testNotSuggestedForNonlocalTarget() {
doNegativeTest();
}
public void testAnnotationLocalSimpleAssignmentTarget() {
doTestAnnotation();
}
@@ -68,4 +97,8 @@ public class PyAnnotateVariableTypeIntentionTest extends PyIntentionTestCase {
private void doTest(@NotNull LanguageLevel languageLevel) {
doTest(PyBundle.message("INTN.annotate.types"), languageLevel);
}
private void doNegativeTest() {
runWithLanguageLevel(LanguageLevel.PYTHON36, () -> doNegativeTest(PyBundle.message("INTN.annotate.types")));
}
}