mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 05:54:25 +08:00
Fix test
This commit is contained in:
@@ -593,8 +593,9 @@ def _random_choice(sequences):
|
|||||||
def _dataclass(value, arguments, callback):
|
def _dataclass(value, arguments, callback):
|
||||||
"""
|
"""
|
||||||
dataclass decorator can be called 2 times with different arguments. One to
|
dataclass decorator can be called 2 times with different arguments. One to
|
||||||
customize it dataclass(eq=True) and another one with the class to
|
customize it dataclass(eq=True) and another one with the class to transform.
|
||||||
transform.
|
|
||||||
|
It supports dataclass, dataclass_transform and attrs.
|
||||||
"""
|
"""
|
||||||
for c in _follow_param(value.inference_state, arguments, 0):
|
for c in _follow_param(value.inference_state, arguments, 0):
|
||||||
if c.is_class():
|
if c.is_class():
|
||||||
|
|||||||
@@ -509,6 +509,10 @@ ids = [
|
|||||||
def test_extensions_dataclass_transform_signature(
|
def test_extensions_dataclass_transform_signature(
|
||||||
Script, skip_pre_python37, start, start_params, include_params
|
Script, skip_pre_python37, start, start_params, include_params
|
||||||
):
|
):
|
||||||
|
has_typing_ext = bool(Script('import typing_extensions').infer())
|
||||||
|
if not has_typing_ext:
|
||||||
|
raise pytest.skip("typing_extensions needed in target environment to run this test")
|
||||||
|
|
||||||
code = dedent(
|
code = dedent(
|
||||||
"""
|
"""
|
||||||
name: str
|
name: str
|
||||||
@@ -596,7 +600,8 @@ def test_dataclass_transform_signature(
|
|||||||
z = 5
|
z = 5
|
||||||
@define
|
@define
|
||||||
class X(Y):'''), ['y']],
|
class X(Y):'''), ['y']],
|
||||||
]
|
],
|
||||||
|
ids=["define", "frozen", "define_customized", "define_subclass", "define_both"]
|
||||||
)
|
)
|
||||||
def test_attrs_signature(Script, skip_pre_python37, start, start_params):
|
def test_attrs_signature(Script, skip_pre_python37, start, start_params):
|
||||||
has_attrs = bool(Script('import attrs').infer())
|
has_attrs = bool(Script('import attrs').infer())
|
||||||
|
|||||||
Reference in New Issue
Block a user