mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Make sure with a test that the staticmethod signature is also correct
This commit is contained in:
@@ -36,11 +36,15 @@ def test_compiled_signature(Script, environment, code, sig, names, op, version):
|
|||||||
assert [n.string_name for n in signature.get_param_names()] == names
|
assert [n.string_name for n in signature.get_param_names()] == names
|
||||||
|
|
||||||
|
|
||||||
class_method_code = '''
|
classmethod_code = '''
|
||||||
class X:
|
class X:
|
||||||
@classmethod
|
@classmethod
|
||||||
def x(cls, a, b):
|
def x(cls, a, b):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def static(a, b):
|
||||||
|
pass
|
||||||
'''
|
'''
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@@ -51,8 +55,10 @@ class X:
|
|||||||
('def f(x,/,y,* ,z): pass\n f(', 'f(x, /, y, *, z)'),
|
('def f(x,/,y,* ,z): pass\n f(', 'f(x, /, y, *, z)'),
|
||||||
('def f(a, /, *, x=3, **kwargs): pass\n f(', 'f(a, /, *, x=3, **kwargs)'),
|
('def f(a, /, *, x=3, **kwargs): pass\n f(', 'f(a, /, *, x=3, **kwargs)'),
|
||||||
|
|
||||||
(class_method_code + 'X.x(', 'x(cls, a, b)'),
|
(classmethod_code + 'X.x(', 'x(cls, a, b)'),
|
||||||
(class_method_code + 'X().x(', 'x(cls, a, b)'),
|
(classmethod_code + 'X().x(', 'x(cls, a, b)'),
|
||||||
|
(classmethod_code + 'X.static(', 'static(a, b)'),
|
||||||
|
(classmethod_code + 'X().static(', 'static(a, b)'),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
def test_tree_signature(Script, environment, code, expected):
|
def test_tree_signature(Script, environment, code, expected):
|
||||||
|
|||||||
Reference in New Issue
Block a user