mirror of
https://github.com/davidhalter/jedi.git
synced 2026-05-24 17:28:36 +08:00
Refactor tests a bit
This commit is contained in:
@@ -54,7 +54,15 @@ def test_help_no_returns(Script, code, kwargs):
|
|||||||
assert not Script(code).help(**kwargs)
|
assert not Script(code).help(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
def test_attribute_docstrings(goto_or_help):
|
@pytest.mark.parametrize(
|
||||||
|
'to_execute, expected_doc', [
|
||||||
|
('X.x', 'Yeah '),
|
||||||
|
('X().x', 'Yeah '),
|
||||||
|
('X.y', 'f g '),
|
||||||
|
('X.z', ''),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
def test_attribute_docstrings(goto_or_help, expected_doc, to_execute):
|
||||||
code = dedent('''\
|
code = dedent('''\
|
||||||
class X:
|
class X:
|
||||||
"ha"
|
"ha"
|
||||||
@@ -65,13 +73,5 @@ def test_attribute_docstrings(goto_or_help):
|
|||||||
z = lambda: 1
|
z = lambda: 1
|
||||||
''')
|
''')
|
||||||
|
|
||||||
d, = goto_or_help(code + 'X.x')
|
d, = goto_or_help(code + to_execute)
|
||||||
assert d.docstring() == 'Yeah '
|
assert d.docstring() == expected_doc
|
||||||
d, = goto_or_help(code + 'X().x')
|
|
||||||
assert d.docstring() == 'Yeah '
|
|
||||||
|
|
||||||
d, = goto_or_help(code + 'X.y')
|
|
||||||
assert d.docstring() == 'f g '
|
|
||||||
|
|
||||||
d, = goto_or_help(code + 'X.z')
|
|
||||||
assert d.docstring() == ''
|
|
||||||
|
|||||||
Reference in New Issue
Block a user