Add tests for #1702, for a rare numpydoc syntax.

It looks like numpydoc, and things like masked array docstrings use a
syntax that make jedi crash:

    fill_value : {var}, optional
            Value used internally for the masked values.
            If ``fill_value`` is not None, it supersedes ``endwith``.

Here we add a test that we do not crash jedi.
This commit is contained in:
Matthias Bussonnier
2020-12-06 18:07:19 -08:00
parent 69750b9bf0
commit 06d6776422

View File

@@ -206,6 +206,24 @@ def test_numpydoc_parameters_set_of_values():
assert 'capitalize' in names
assert 'numerator' in names
@pytest.mark.skipif(numpydoc_unavailable,
reason='numpydoc module is unavailable')
def test_numpydoc_parameters_set_single_value():
"""
This is found in numpy masked-array I'm not too sure what this means but should not crash
"""
s = dedent('''
def foobar(x, y):
"""
Parameters
----------
x : {var}, optional
"""
x.''')
names = [c.name for c in jedi.Script(s).complete()]
# just don't crash
assert names == []
@pytest.mark.skipif(numpydoc_unavailable,
reason='numpydoc module is unavailable')