forked from VimPlug/jedi
fix a docstr issue
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user