def test_no_duplicate_modules():
 import sys
 jedipath = os.path.dirname(os.path.abspath(jedi.__file__))
 def is_submodule(m):
  try:
   filepath = m.__file__
  except AttributeError:
   return False
  return os.path.abspath(filepath).startswith(jedipath)
 modules = list(filter(is_submodule, sys.modules.values()))
 top_modules = [m for m in modules if (not m.__name__.startswith('jedi.'))]
 for m in modules:
  if (m is jedi):
   continue
  for tm in top_modules:
   try:
    imported = getattr(m, tm.__name__)
   except AttributeError:
    continue
   if inspect.ismodule(imported):
    assert (imported is tm)

def test_no_duplicate_modules ( ) : import sys jedipath = os . path . dirname ( os . path . abspath ( jedi . __file__ ) ) def is_submodule ( m ) : try : filepath = m . __file__ except AttributeError : return False return os . path . abspath ( filepath ) . startswith ( jedipath ) modules = list ( filter ( is_submodule , sys . modules . values ( ) ) ) top_modules = [ m for m in modules if ( not m . __name__ . startswith ( 'jedi.' ) ) ] for m in modules : if ( m is jedi ) : continue for tm in top_modules : try : imported = getattr ( m , tm . __name__ ) except AttributeError : continue if inspect . ismodule ( imported ) : assert ( imported is tm )
make sure that import hack works as expected .