forked from VimPlug/jedi
Change a few tests for new typeshed
This commit is contained in:
@@ -8,6 +8,9 @@ Unreleased
|
|||||||
|
|
||||||
- Python 3.14 support
|
- Python 3.14 support
|
||||||
- Removed support for Python 3.8 and 3.9
|
- Removed support for Python 3.8 and 3.9
|
||||||
|
- Upgraded Typeshed
|
||||||
|
- Better support for Final/ClassVar
|
||||||
|
- ``__new__`` is now also recognized as a signature
|
||||||
|
|
||||||
0.19.2 (2024-11-10)
|
0.19.2 (2024-11-10)
|
||||||
+++++++++++++++++++
|
+++++++++++++++++++
|
||||||
|
|||||||
@@ -108,10 +108,10 @@ class X:
|
|||||||
('from typing import cast\ncast(', {
|
('from typing import cast\ncast(', {
|
||||||
'cast(typ: object, val: Any) -> Any',
|
'cast(typ: object, val: Any) -> Any',
|
||||||
'cast(typ: str, val: Any) -> Any',
|
'cast(typ: str, val: Any) -> Any',
|
||||||
'cast(typ: Type[_T], val: Any) -> _T'}),
|
'cast(typ: type[_T], val: Any) -> _T'}),
|
||||||
('from typing import TypeVar\nTypeVar(',
|
('from typing import TypeVar\nTypeVar(',
|
||||||
'TypeVar(name: str, *constraints: Type[Any], bound: Union[None, Type[Any], str]=..., '
|
'TypeVar(name: str, *constraints: Any, bound: Any | None=None, covariant: bool=False, '
|
||||||
'covariant: bool=..., contravariant: bool=...)'),
|
'contravariant: bool=False)'),
|
||||||
('from typing import List\nList(', None),
|
('from typing import List\nList(', None),
|
||||||
('from typing import List\nList[int](', None),
|
('from typing import List\nList[int](', None),
|
||||||
('from typing import Tuple\nTuple(', None),
|
('from typing import Tuple\nTuple(', None),
|
||||||
@@ -119,7 +119,7 @@ class X:
|
|||||||
('from typing import Optional\nOptional(', None),
|
('from typing import Optional\nOptional(', None),
|
||||||
('from typing import Optional\nOptional[int](', None),
|
('from typing import Optional\nOptional[int](', None),
|
||||||
('from typing import Any\nAny(', None),
|
('from typing import Any\nAny(', None),
|
||||||
('from typing import NewType\nNewType(', 'NewType(name: str, tp: Type[_T]) -> Type[_T]'),
|
('from typing import NewType\nNewType(', 'NewType(name: str, tp: Any)'),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
def test_tree_signature(Script, environment, code, expected):
|
def test_tree_signature(Script, environment, code, expected):
|
||||||
@@ -245,11 +245,8 @@ def test_pow_signature(Script, environment):
|
|||||||
# See github #1357
|
# See github #1357
|
||||||
sigs = Script('pow(').get_signatures()
|
sigs = Script('pow(').get_signatures()
|
||||||
strings = {sig.to_string() for sig in sigs}
|
strings = {sig.to_string() for sig in sigs}
|
||||||
assert strings == {'pow(base: _SupportsPow2[_E, _T_co], exp: _E) -> _T_co',
|
assert 'pow(base: _PositiveInteger, exp: float, mod: None=None) -> float' in strings
|
||||||
'pow(base: _SupportsPow3[_E, _M, _T_co], exp: _E, mod: _M) -> _T_co',
|
assert len(strings) > 4
|
||||||
'pow(base: float, exp: float, mod: None=...) -> float',
|
|
||||||
'pow(base: int, exp: int, mod: None=...) -> Any',
|
|
||||||
'pow(base: int, exp: int, mod: int) -> int'}
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@@ -398,7 +395,7 @@ def test_dataclass_signature(
|
|||||||
Script, start, start_params, include_params, environment
|
Script, start, start_params, include_params, environment
|
||||||
):
|
):
|
||||||
price_type = "Final[float]"
|
price_type = "Final[float]"
|
||||||
price_type_infer = "object"
|
price_type_infer = "_SpecialForm"
|
||||||
|
|
||||||
code = dedent(
|
code = dedent(
|
||||||
f"""
|
f"""
|
||||||
@@ -716,7 +713,7 @@ def test_extensions_dataclass_transform_signature(
|
|||||||
raise pytest.skip("typing_extensions needed in target environment to run this test")
|
raise pytest.skip("typing_extensions needed in target environment to run this test")
|
||||||
|
|
||||||
price_type = "Final[float]"
|
price_type = "Final[float]"
|
||||||
price_type_infer = "object"
|
price_type_infer = "_SpecialForm"
|
||||||
|
|
||||||
code = dedent(
|
code = dedent(
|
||||||
f"""
|
f"""
|
||||||
@@ -802,7 +799,7 @@ def test_dataclass_transform_signature(
|
|||||||
quantity, = sig.params[-1].infer()
|
quantity, = sig.params[-1].infer()
|
||||||
assert quantity.name == 'int'
|
assert quantity.name == 'int'
|
||||||
price, = sig.params[-2].infer()
|
price, = sig.params[-2].infer()
|
||||||
assert price.name == 'object'
|
assert price.name == '_SpecialForm'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
|||||||
Reference in New Issue
Block a user