Fix errors around docs of namespace packages, fixes #1890, fixes #1822

This commit is contained in:
Dave Halter
2022-11-13 19:50:08 +01:00
parent 6e5db3f479
commit b0d5fc2bd0
2 changed files with 4 additions and 1 deletions

View File

@@ -248,7 +248,7 @@ class ValueNameMixin:
def get_defining_qualified_value(self):
context = self.parent_context
if context.is_module() or context.is_class():
if context is not None and (context.is_module() or context.is_class()):
return self.parent_context.get_value() # Might be None
return None

View File

@@ -43,6 +43,9 @@ def test_implicit_namespace_package(Script):
solution = "foo = '%s'" % solution
assert completion.description == solution
c, = script_with_path('import pkg').complete()
assert c.docstring() == ""
def test_implicit_nested_namespace_package(Script):
code = 'from implicit_nested_namespaces.namespace.pkg.module import CONST'