1
0
forked from VimPlug/jedi

Add doctests for search_param_in_docstr

This commit is contained in:
Takafumi Arakaki
2013-01-30 21:03:48 +01:00
parent 691177c20c
commit 9a35301a29

View File

@@ -39,6 +39,17 @@ def follow_param(param):
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
patterns = [ re.compile(p % re.escape(param_str)) for p in DOCSTRING_PARAM_PATTERNS ]
for pattern in patterns: