def test_module_completion(): """Test module_completion.""" # Some simple tests. # Sort operations are done by the completion widget, so we have to # replicate them here. # We've chosen to use xml on most tests because it's on the standard # library. This way we can ensure they work on all plataforms. assert sorted(module_completion('import xml.')) == \ ['xml.dom', 'xml.etree', 'xml.parsers', 'xml.sax'] assert sorted(module_completion('import xml.d')) == ['xml.dom'] assert module_completion('from xml.etree ') == ['import '] assert sorted(module_completion('from xml.etree import '), key=str.lower) ==\ ['cElementTree', 'ElementInclude', 'ElementPath', 'ElementTree'] assert module_completion('import sys, zl') == ['zlib'] s = 'from xml.etree.ElementTree import ' assert module_completion(s + 'V') == ['VERSION'] if PY3: assert sorted(module_completion(s + 'VERSION, XM')) == \ ['XML', 'XMLID', 'XMLParser', 'XMLPullParser'] else: assert sorted(module_completion(s + 'VERSION, XM')) == \ ['XML', 'XMLID', 'XMLParser', 'XMLTreeBuilder'] assert module_completion(s + '(dum') == ['dump'] assert module_completion(s + '(dump, Su') == ['SubElement'] assert 'os.path' in get_preferred_submodules()
def test_module_completion(): """Test module_completion.""" # Some simple tests. # Sort operations are done by the completion widget, so we have to # replicate them here. # We've chosen to use xml on most tests because it's on the standard # library. This way we can ensure they work on all plataforms. assert sorted(module_completion('import xml.')) == \ ['xml.dom', 'xml.etree', 'xml.parsers', 'xml.sax'] assert sorted(module_completion('import xml.d')) == ['xml.dom'] assert module_completion('from xml.etree ') == ['import '] assert sorted(module_completion('from xml.etree import '), key=str.lower) ==\ ['cElementTree', 'ElementInclude', 'ElementPath', 'ElementTree'] assert module_completion('import sys, zl') == ['zlib'] s = 'from xml.etree.ElementTree import ' assert module_completion(s + 'V') == ['VERSION'] if PY3: assert sorted(module_completion(s + 'VERSION, XM')) == \ ['XML', 'XMLID', 'XMLParser', 'XMLPullParser'] else: assert sorted(module_completion(s + 'VERSION, XM')) == \ ['XML', 'XMLID', 'XMLParser', 'XMLTreeBuilder'] assert module_completion(s + '(dum') == ['dump'] assert module_completion(s + '(dump, Su') == ['SubElement'] assert 'os.path' in get_preferred_submodules()
def load_plugin(self): """Load the Rope introspection plugin""" if not programs.is_module_installed('rope'): raise ImportError('Requires Rope') self.project = None self.create_rope_project(root_path=get_conf_path()) submods = get_preferred_submodules() actual = [] for submod in submods: try: imp.find_module(submod) actual.append(submod) except ImportError: pass if self.project is not None: self.project.prefs.set('extension_modules', actual)
def load_plugin(self): """Load the Rope introspection plugin""" if not programs.is_module_installed('rope', ROPE_REQVER): raise ImportError('Requires Rope %s' % ROPE_REQVER) self.project = None self.create_rope_project(root_path=get_conf_path()) submods = get_preferred_submodules() actual = [] for submod in submods: try: imp.find_module(submod) actual.append(submod) except ImportError: pass if self.project is not None: self.project.prefs.set('extension_modules', actual)
def test_module_completion(): """Test module_completion.""" assert 'numpy.linalg' in get_preferred_submodules()