PY-74116 Move other tests on completion of importable name from typing to Py3CompletionTest

And make their setup similar to
testParenthesesAreNotInsertedAfterNamesDefinedAsFunctionsInTypingPy.

typing.py in the test directory has higher priority than typing.pyi in Typeshed,
as a user .py file (see PyResolveImportUtil.Priority), so
PyResolveImportUtil.resolveQualifiedName can't find typing.pyi, and it's not used
in the tests.

GitOrigin-RevId: 3dd51af04f5e5e16e7167dea32b248bca240b18e
This commit is contained in:
Mikhail Golubev
2025-01-03 17:01:18 +02:00
committed by intellij-monorepo-bot
parent cb6906c311
commit ccd7847c0a
10 changed files with 20 additions and 49 deletions

View File

@@ -2197,20 +2197,6 @@ public abstract class PythonCommonCompletionTest extends PythonCommonTestCase {
});
}
// PY-62208
public void testImportableFunctionsFromTypingSuggestedInsideTypeHints() {
runWithLanguageLevel(LanguageLevel.getLatest(), () -> {
doMultiFileTest();
});
}
// PY-62208
public void testImportableVariablesFromTypingSuggestedInsideTypeHints() {
runWithLanguageLevel(LanguageLevel.getLatest(), () -> {
doMultiFileTest();
});
}
// PY-62208
public void testImportableFunctionsAndVariablesNotSuggestedInsidePatterns() {
runWithLanguageLevel(LanguageLevel.getLatest(), () -> {

View File

@@ -1,22 +0,0 @@
@_SpecialForm
def Final(self, parameters):
"""Special typing construct to indicate final names to type checkers.
A final name cannot be re-assigned or overridden in a subclass.
For example::
MAX_SIZE: Final = 9000
MAX_SIZE += 1 # Error reported by type checker
class Connection:
TIMEOUT: Final[int] = 10
class FastConnector(Connection):
TIMEOUT = 1 # Error reported by type checker
There is no runtime checking of these properties.
"""
item = _type_check(parameters, f'{self} accepts only single type.')
return _GenericAlias(self, (item,))

View File

@@ -1,12 +0,0 @@
Tuple = _TupleType(tuple, -1, inst=False, name='Tuple')
Tuple.__doc__ = \
"""Deprecated alias to builtins.tuple.
Tuple[X, Y] is the cross-product type of X and Y.
Example: Tuple[T1, T2] is a tuple of two elements corresponding
to type variables T1 and T2. Tuple[int, float, str] is a tuple
of an int, a float and a string.
To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
"""

View File

@@ -764,7 +764,26 @@ public class Py3CompletionTest extends PyTestCase {
def TypedDict(typename, fields=None, /, *, total=True, **kwargs):
...
""", ignored -> {
doMultiFileTest();
doTest();
});
}
// PY-62208
public void testImportableFunctionsFromTypingSuggestedInsideTypeHints() {
runWithAdditionalFileInLibDir("typing.py", """
def Final(self, parameters):
...
""", ignored -> {
doTest();
});
}
// PY-62208
public void testImportableVariablesFromTypingSuggestedInsideTypeHints() {
runWithAdditionalFileInLibDir("typing.py", """
Tuple = _TupleType(tuple, -1, inst=False, name='Tuple')
""", ignored -> {
doTest();
});
}