forked from VimPlug/jedi
Add doctests for search_param_in_docstr
This commit is contained in:
@@ -39,6 +39,17 @@ def follow_param(param):
|
|||||||
|
|
||||||
|
|
||||||
def search_param_in_docstr(docstr, param_str):
|
def search_param_in_docstr(docstr, param_str):
|
||||||
|
"""
|
||||||
|
Search `docstr` for a type of `param_str`.
|
||||||
|
|
||||||
|
>>> search_param_in_docstr(':type param: int', 'param')
|
||||||
|
'int'
|
||||||
|
>>> search_param_in_docstr('@type param: int', 'param')
|
||||||
|
'int'
|
||||||
|
>>> search_param_in_docstr('no document', 'param') is None
|
||||||
|
True
|
||||||
|
|
||||||
|
"""
|
||||||
# look at #40 to see definitions of those params
|
# look at #40 to see definitions of those params
|
||||||
patterns = [ re.compile(p % re.escape(param_str)) for p in DOCSTRING_PARAM_PATTERNS ]
|
patterns = [ re.compile(p % re.escape(param_str)) for p in DOCSTRING_PARAM_PATTERNS ]
|
||||||
for pattern in patterns:
|
for pattern in patterns:
|
||||||
|
|||||||
Reference in New Issue
Block a user