use of com.python.pydev.codecompletion.ctxinsensitive.CtxParticipant in project Pydev by fabioz.
the class ParameterCompletionTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
CompiledModule.COMPILED_MODULES_ENABLED = false;
useOriginalRequestCompl = true;
participant = new CtxParticipant();
ExtensionHelper.testingParticipants = new HashMap<String, List<Object>>();
ArrayList<Object> participants = new ArrayList<Object>();
/*IPyDevCompletionParticipant*/
participants.add(participant);
ExtensionHelper.testingParticipants.put(ExtensionHelper.PYDEV_COMPLETION, participants);
codeCompletion = new PyCodeCompletion();
this.restorePythonPath(false);
final IEclipsePreferences prefs = new InMemoryEclipsePreferences();
PyCodeCompletionPreferences.getPreferencesForTests = () -> prefs;
prefs.putBoolean(PyCodeCompletionPreferences.MATCH_BY_SUBSTRING_IN_CODE_COMPLETION, false);
}
use of com.python.pydev.codecompletion.ctxinsensitive.CtxParticipant in project Pydev by fabioz.
the class CompletionParticipantTest method testImportCompletion2.
public void testImportCompletion2() throws Exception {
participant = new CtxParticipant();
ICompletionProposalHandle[] proposals = requestCompl("xml", -1, -1, new String[] {});
assertNotContains("xml - xmlrpclib", proposals);
requestCompl(new File(TestDependent.TEST_PYSRC_TESTING_LOC + "/testlib/unittest/guitestcase.py"), "guite", -1, 0, new String[] {});
// the behavior changes for tokens on modules
AnalysisPreferences.TESTS_DO_IGNORE_IMPORT_STARTING_WITH_UNDER = true;
try {
proposals = requestCompl("Priv3", new String[] { "Priv3 - relative.rel1._priv1._priv2._priv3" });
Document document = new Document("Priv3");
((CtxInsensitiveImportComplProposal) proposals[0]).indentString = " ";
((CtxInsensitiveImportComplProposal) proposals[0]).apply(document, ' ', 0, 5);
PySelectionTest.checkStrEquals("from relative.rel1 import Priv3\r\nPriv3", document.get());
} finally {
AnalysisPreferences.TESTS_DO_IGNORE_IMPORT_STARTING_WITH_UNDER = false;
}
}
use of com.python.pydev.codecompletion.ctxinsensitive.CtxParticipant in project Pydev by fabioz.
the class CompletionParticipantBuiltinsTest method testImportCompletion2.
// public void testCompletionBuiltins() throws Exception {
// // wx.Frame.CaptureMouse()
// // wx.Frame.CacheBestSize()
// // wx.Frame.AcceptsFocus()
// // wx.Frame.AcceptsFocusFromKeyboard()
// useOriginalRequestCompl = true;
// String s = "" +
// "def m1(a):\n" +
// " a.Accepts";
// requestCompl(s, -1, -1, new String[]{"AcceptsFocus()", "AcceptsFocusFromKeyboard()"});
//
//
// }
public void testImportCompletion2() throws Exception {
if (SharedCorePlugin.skipKnownFailures()) {
return;
}
if (TestDependent.PYTHON2_WXPYTHON_PACKAGES != null) {
CompiledModule module = new CompiledModule("wx", this.getManager().getModulesManager(), this.getManager().getNature());
participant = new CtxParticipant();
ICompletionProposalHandle[] proposals = requestCompl("Frame", -1, -1, new String[] {});
// Expected to fail. See: org.python.pydev.ast.analysis.additionalinfo.builders.AdditionalInfoModulesObserver.notifyCompiledModuleCreated(CompiledModule, IModulesManager)
assertContains("Frame - wx", proposals);
}
}
use of com.python.pydev.codecompletion.ctxinsensitive.CtxParticipant in project Pydev by fabioz.
the class CompletionParticipantBuiltinsTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
CompiledModule.COMPILED_MODULES_ENABLED = true;
participant = new CtxParticipant();
ExtensionHelper.testingParticipants = new HashMap<String, List<Object>>();
ArrayList<Object> participants = new ArrayList<Object>();
/*IPyDevCompletionParticipant*/
participants.add(participant);
ExtensionHelper.testingParticipants.put(ExtensionHelper.PYDEV_COMPLETION, participants);
codeCompletion = new PyCodeCompletion();
this.restorePythonPath(false);
}
use of com.python.pydev.codecompletion.ctxinsensitive.CtxParticipant in project Pydev by fabioz.
the class CompletionParticipantTest method testImportCompletionFromZip.
public void testImportCompletionFromZip() throws Exception {
participant = new CtxParticipant();
ICompletionProposalHandle[] proposals = requestCompl("myzipc", -1, -1, new String[] {});
assertContains("MyZipClass - myzipmodule.myzipfile", proposals);
proposals = requestCompl("myegg", -1, -1, new String[] {});
assertContains("MyEggClass - myeggmodule.myeggfile", proposals);
}
Aggregations