def test_get_docstring_for_builtin_functions(project): source, pos = get_source_and_pos(''' map(| ''') sig, docstring = get_docstring(project, source, pos, None) assert sig == None assert 'map(' in docstring
def test_get_docstring_for_dyn_functions(project): project.create_module('toimport', ''' def boo(arg1, arg2): """Boo docs""" pass ''') source, pos = get_source_and_pos(''' import toimport toimport.boo(| ''') sig, docstring = get_docstring(project, source, pos, None) assert sig == 'boo(arg1, arg2)' assert 'Boo docs' in docstring
def get_docstring(self, path, source, position, filename): return get_docstring(self.get_project(path), source, position, filename)
def do_docstring(project, source, filename=None): filename = filename or 'test.py' source, pos = get_source_and_pos(source) return get_docstring(project, source, pos, filename)