mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-16412 Import Tuple for parametrized types of tuples
This commit is contained in:
committed by
Andrey Vlasovskikh
parent
f27611869f
commit
28e74fcc04
@@ -305,6 +305,9 @@ public class PyTypeHintGenerationUtil {
|
||||
classes.add(pyClass);
|
||||
}
|
||||
}
|
||||
else if (type instanceof PyTupleType) {
|
||||
names.add("Tuple");
|
||||
}
|
||||
for (PyType pyType : ((PyCollectionType)type).getElementTypes()) {
|
||||
collectImportTargetsFromType(pyType, classes, names);
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
v<caret>ar = (1, 'foo', None)
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
from typing import Tuple
|
||||
|
||||
var: [Tuple[int, str, None]] = (1, 'foo', None)
|
||||
+4
@@ -207,6 +207,10 @@ public class PyAnnotateVariableTypeIntentionTest extends PyIntentionTestCase {
|
||||
doAnnotationTest();
|
||||
}
|
||||
|
||||
public void testAnnotationTupleType() {
|
||||
doAnnotationTest();
|
||||
}
|
||||
|
||||
private void doAnnotationTest() {
|
||||
doTest(LanguageLevel.PYTHON36);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user