diff --git a/jedi/parsing_representation.py b/jedi/parsing_representation.py index 378eaa48..1d563fcb 100644 --- a/jedi/parsing_representation.py +++ b/jedi/parsing_representation.py @@ -327,6 +327,7 @@ class Scope(Simple, IsScope): return "<%s: %s@%s-%s>" % (type(self).__name__, name, self.start_pos[0], self.end_pos[0]) + def _enables_absolute_import(imp): """ Checks if the import is a ``__future__`` import that enables the @@ -335,13 +336,14 @@ def _enables_absolute_import(imp): namespace, feature = imp.from_ns.names[0], imp.namespace.names[0] return namespace == "__future__" and feature == "absolute_import" + class Module(IsScope): - """ For isinstance checks. fast_parser.Module also inherits from this. """ - pass + """ + For isinstance checks. fast_parser.Module also inherits from this. + """ class SubModule(Scope, Module): - """ The top scope, which is always a module. Depending on the underlying parser this may be a full module or just a part diff --git a/test/absolute_import/local_module.py b/test/absolute_import/local_module.py index 0064586e..d256fd67 100644 --- a/test/absolute_import/local_module.py +++ b/test/absolute_import/local_module.py @@ -9,5 +9,6 @@ from __future__ import absolute_import import unittest # this is stdlib unittest, but jedi gets the local one + class Assertions(unittest.TestCase): pass diff --git a/test/absolute_import/unittest.py b/test/absolute_import/unittest.py index d8957afc..eee1e937 100644 --- a/test/absolute_import/unittest.py +++ b/test/absolute_import/unittest.py @@ -8,6 +8,7 @@ will get this module again, causing infinite recursion. """ from local_module import Assertions + class TestCase(Assertions): def test(self): self.assertT