diff --git a/jedi/plugins/stdlib.py b/jedi/plugins/stdlib.py index 1018e808..604cd595 100644 --- a/jedi/plugins/stdlib.py +++ b/jedi/plugins/stdlib.py @@ -593,8 +593,9 @@ def _random_choice(sequences): def _dataclass(value, arguments, callback): """ dataclass decorator can be called 2 times with different arguments. One to - customize it dataclass(eq=True) and another one with the class to - transform. + customize it dataclass(eq=True) and another one with the class to transform. + + It supports dataclass, dataclass_transform and attrs. """ for c in _follow_param(value.inference_state, arguments, 0): if c.is_class(): diff --git a/test/test_inference/test_signature.py b/test/test_inference/test_signature.py index 3aeca0bb..21744ad8 100644 --- a/test/test_inference/test_signature.py +++ b/test/test_inference/test_signature.py @@ -509,6 +509,10 @@ ids = [ def test_extensions_dataclass_transform_signature( 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( """ name: str @@ -596,7 +600,8 @@ def test_dataclass_transform_signature( z = 5 @define class X(Y):'''), ['y']], - ] + ], + ids=["define", "frozen", "define_customized", "define_subclass", "define_both"] ) def test_attrs_signature(Script, skip_pre_python37, start, start_params): has_attrs = bool(Script('import attrs').infer())