PY-27392 Better names of intentions for functions and variable type hints

Now it's possible to distinguish between them when both are offered
on a target of a call expression result assignment (as it was noticed
during the testing of PY-16412).
This commit is contained in:
Mikhail Golubev
2018-02-05 21:41:59 +03:00
committed by Andrey Vlasovskikh
parent 149eefa75e
commit b7ebc74682
9 changed files with 47 additions and 36 deletions
@@ -20,17 +20,17 @@ public class PyAnnotateTypesIntentionTest extends PyIntentionTestCase {
runWithLanguageLevel(
LanguageLevel.PYTHON34,
() -> {
doIntentionTest(PyBundle.message("INTN.annotate.types"), getTestName(true) + ".py", "foo_decl.py");
doIntentionTest(PyBundle.message("INTN.add.type.hints.for.function.family"), getTestName(true) + ".py", "foo_decl.py");
myFixture.checkResultByFile("foo_decl.py", "foo_decl_after.py", false);
}
);
}
public void testTypeComment() {
doTest(PyBundle.message("INTN.annotate.types"), LanguageLevel.PYTHON27);
doTest(PyBundle.message("INTN.add.type.hints.for.function.family"), LanguageLevel.PYTHON27);
}
private void doTest() {
doTest(PyBundle.message("INTN.annotate.types"), LanguageLevel.PYTHON34);
doTest(PyBundle.message("INTN.add.type.hints.for.function.family"), LanguageLevel.PYTHON34);
}
}
@@ -227,6 +227,10 @@ public class PyAnnotateVariableTypeIntentionTest extends PyIntentionTestCase {
doAnnotationTest();
}
public void testConflictWithAnnotationFunctionTypeIntention() {
doTest(LanguageLevel.PYTHON36);
}
private void doAnnotationTest() {
doTest(LanguageLevel.PYTHON36);
}
@@ -236,12 +240,12 @@ public class PyAnnotateVariableTypeIntentionTest extends PyIntentionTestCase {
}
private void doNegativeTest() {
runWithLanguageLevel(LanguageLevel.PYTHON36, () -> doNegativeTest(PyBundle.message("INTN.annotate.types")));
runWithLanguageLevel(LanguageLevel.PYTHON36, () -> doNegativeTest(PyBundle.message("INTN.add.type.hint.for.variable.family")));
}
public void doMultiFileAnnotationTest() {
runWithLanguageLevel(LanguageLevel.PYTHON36, () -> {
doMultiFileTest(PyBundle.message("INTN.annotate.types"));
doMultiFileTest(PyBundle.message("INTN.add.type.hint.for.variable.family"));
});
}
@@ -256,6 +260,6 @@ public class PyAnnotateVariableTypeIntentionTest extends PyIntentionTestCase {
}
private void doTest(@NotNull LanguageLevel languageLevel) {
doTest(PyBundle.message("INTN.annotate.types"), languageLevel);
doTest(PyBundle.message("INTN.add.type.hint.for.variable.family"), languageLevel);
}
}