findCompletion(props, "Create newpack.module_new module").apply(editor.getISourceViewer(), '\n', 0, offset);
assertTrue(mod2.exists());
assertEquals(1, pyEditCreated.size());
PyEdit editCreated = pyEditCreated.get(0);
//Create class at module
mod1Contents = "" +
"from newpack import module_new\n" +
"module_new.NewClass";
setContentsAndWaitReparseAndError(mod1Contents);
quickFix = new TddCodeGenerationQuickFixParticipant();
offset = mod1Contents.length();
ps = new PySelection(editor.getDocument(), offset);
assertTrue(quickFix.isValid(ps, "", editor, offset));
props = waitForQuickFixProps(quickFix, ps, offset);
findCompletion(props, "Create NewClass class at module_new.py").apply(editor.getISourceViewer(), '\n', 0,
offset);
String contents = editCreated.getDocument().get();
assertContentsEqual("" +
"class NewClass(object):\n" +
" pass\n" +
"\n" +
"\n" +
"", contents);
editCreated.getSite().getPage().saveEditor(editCreated, false);
//Create __init__ at class.
mod1Contents = "" +
"'''\n" +
"'''\n" +
"" +
"def bar():\n" +
" from newpack import module_new\n"
+
" module_new.NewClass(param)"; //the 'undefined param' will be the error
setContentsAndWaitReparseAndError(mod1Contents);
quickFix = new TddCodeGenerationQuickFixParticipant();
offset = mod1Contents.length();
ps = new PySelection(editor.getDocument(), offset);
assertTrue(quickFix.isValid(ps, "", editor, offset));
props = waitForQuickFixProps(quickFix, ps, offset);
findCompletion(props, "Create NewClass __init__ (newpack.module_new)").apply(editor.getISourceViewer(),
'\n', 0, offset);
contents = editCreated.getDocument().get();
assertContentsEqual("" +
"class NewClass(object):\n" +
" \n" +
" \n"
+