1
0
forked from VimPlug/jedi

fix a docstr issue

This commit is contained in:
Dave Halter
2014-01-12 19:22:31 +01:00
parent dfb494b9c4
commit 4b319ad817
2 changed files with 11 additions and 4 deletions

View File

@@ -96,7 +96,7 @@ def search_scope(scope, obj_name):
return s return s
def _faked(module, obj, name=None): def _faked(module, obj, name):
# Crazy underscore actions to try to escape all the internal madness. # Crazy underscore actions to try to escape all the internal madness.
obj = obj.__class__ if is_class_instance(obj) else obj obj = obj.__class__ if is_class_instance(obj) else obj
if module is None: if module is None:
@@ -138,9 +138,12 @@ def _faked(module, obj, name=None):
return search_scope(cls, name) return search_scope(cls, name)
def get_faked(*args, **kwargs): def get_faked(module, obj, name=None):
result = _faked(*args, **kwargs) result = _faked(module, obj, name)
if not isinstance(result, Class): if not isinstance(result, Class) and result is not None:
# Set the docstr which was previously not set (faked modules don't
# contain it).
result.docstr = obj.__doc__
return result return result

View File

@@ -23,6 +23,10 @@ def test_fake_loading():
assert isinstance(from_name, Function) assert isinstance(from_name, Function)
def test_fake_docstr():
assert compiled.create(next).docstr == next.__doc__
def test_parse_function_doc_illegal_docstr(): def test_parse_function_doc_illegal_docstr():
docstr = """ docstr = """
test_func(o test_func(o