[Pydev-cvs] org.python.pydev/tests/org/python/pydev/editor/correctionassist/heuristics AssistCreat
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2008-09-28 12:46:34
|
Update of /cvsroot/pydev/org.python.pydev/tests/org/python/pydev/editor/correctionassist/heuristics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4313/tests/org/python/pydev/editor/correctionassist/heuristics Modified Files: AssistCreateInModuleTest.java AssistAssignTest.java Log Message: Synching to latest changes: Pydev <ul> <li><strong>Editor</strong>: Cursor settings no longer overridden</li> <li><strong>Code-completion</strong>: If __all__ is defined with runtime elements (and not only in a single assign statement), it's ignored for code-completion purposes</li> <li><strong>Debugger</strong>: Pythonpath the same in debug and regular modes (sys.path[0] is the same directory as the file run)</li> <li><strong>Debugger</strong>: Persist choices done in the debugger when files from the debugger are not found</li> <li><strong>Interpreter config</strong>: "email" automatically added to the "forced builtins"</li> <li><strong>Parser</strong>: Correctly recognizing absolute import with 3 or more levels</li> <li><strong>Syntax check</strong>: Option to do only on active editor</li> </ul> Also: tabs changed for spaces Index: AssistCreateInModuleTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/tests/org/python/pydev/editor/correctionassist/heuristics/AssistCreateInModuleTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AssistCreateInModuleTest.java 25 Sep 2005 13:07:04 -0000 1.8 --- AssistCreateInModuleTest.java 28 Sep 2008 12:45:42 -0000 1.9 *************** *** 43,72 **** // public void testAssistMethod() throws BadLocationException { // assist = new AssistCreateMethodInModule(); ! // String d = ""+ ! // "from testAssist import assist\n" + ! // "assist.NewMethod(a,b)"; // ! // String res = "\n" + ! // "def NewMethod(a,b):\n" + ! // " '''\n"+ ! // " @param a:\n"+ ! // " @param b:\n"+ ! // " '''\n"+ ! // " "; // ! // checkCreateMethod(d, res, "testAssist.assist", true, -1, "NewMethod"); // ! // d = ""+ ! // "from testAssist import assist\n" + ! // "NewMethod(a,b)"; ! // checkCreateMethod(d, res, "", true, -1, "NewMethod"); // ! // d = ""+ ! // "class NewClass(object): \n" + ! // " \n" + ! // " def NewMethod(a,b): \n" + ! // " pass \n"; ! // checkCreateMethod(d, res, "", false, 0, ""); ! // checkCreateMethod(d, res, "", false, 2, ""); // } // --- 43,72 ---- // public void testAssistMethod() throws BadLocationException { // assist = new AssistCreateMethodInModule(); ! // String d = ""+ ! // "from testAssist import assist\n" + ! // "assist.NewMethod(a,b)"; // ! // String res = "\n" + ! // "def NewMethod(a,b):\n" + ! // " '''\n"+ ! // " @param a:\n"+ ! // " @param b:\n"+ ! // " '''\n"+ ! // " "; // ! // checkCreateMethod(d, res, "testAssist.assist", true, -1, "NewMethod"); // ! // d = ""+ ! // "from testAssist import assist\n" + ! // "NewMethod(a,b)"; ! // checkCreateMethod(d, res, "", true, -1, "NewMethod"); // ! // d = ""+ ! // "class NewClass(object): \n" + ! // " \n" + ! // " def NewMethod(a,b): \n" + ! // " pass \n"; ! // checkCreateMethod(d, res, "", false, 0, ""); ! // checkCreateMethod(d, res, "", false, 2, ""); // } // *************** *** 83,94 **** // Document doc = new Document(docStr); // ! // int offset = 0; ! // if (line == -1){ ! // offset = docStr.length(); ! // }else{ ! // IRegion lineInformation = doc.getLineInformation(line); ! // offset = lineInformation.getOffset() + lineInformation.getLength(); ! // } ! // // PySelection ps = new PySelection(doc, new TextSelection(doc, offset, 0)); // String sel = PyAction.getLineWithoutComments(ps); --- 83,94 ---- // Document doc = new Document(docStr); // ! // int offset = 0; ! // if (line == -1){ ! // offset = docStr.length(); ! // }else{ ! // IRegion lineInformation = doc.getLineInformation(line); ! // offset = lineInformation.getOffset() + lineInformation.getLength(); ! // } ! // // PySelection ps = new PySelection(doc, new TextSelection(doc, offset, 0)); // String sel = PyAction.getLineWithoutComments(ps); *************** *** 96,107 **** // assertEquals(isValid, assist.isValid(ps, sel, null, offset)); // if(isValid){ ! // List props = assist.getProps(ps, null, null, nature, null, offset); ! // assertEquals(1, props.size()); ! // SourceModuleProposal p = (SourceModuleProposal) props.get(0); ! // ! // ! // assertEquals(res, p.getReplacementStr()); ! // assertEquals(moduleName, p.module.getName()); ! // assertTrue(p.getDisplayString().indexOf(tok) != -1); // } // } --- 96,107 ---- // assertEquals(isValid, assist.isValid(ps, sel, null, offset)); // if(isValid){ ! // List props = assist.getProps(ps, null, null, nature, null, offset); ! // assertEquals(1, props.size()); ! // SourceModuleProposal p = (SourceModuleProposal) props.get(0); ! // ! // ! // assertEquals(res, p.getReplacementStr()); ! // assertEquals(moduleName, p.module.getName()); ! // assertTrue(p.getDisplayString().indexOf(tok) != -1); // } // } *************** *** 113,142 **** // */ // public void testAssistClass() throws BadLocationException { ! // String docStr = ""+ ! // "from testAssist import assist\n" + ! // "assist.NewClass(a,b)"; ! // String moduleName = "testAssist.assist"; ! // int nProps = 1; ! // assist = new AssistCreateClassInModule(); ! // checkAssistClass(docStr, moduleName, nProps,-1,0, "NewClass", true); ! // // ! // nProps = 1; ! // moduleName = ""; ! // docStr = ""+ ! // "from testAssist import assist\n" + ! // "newClass = NewClass(a,b)"; ! // checkAssistClass(docStr, moduleName, nProps,-1,0, "NewClass", true); // ! // docStr = ""+ ! // "from testAssist import assist\n" + ! // "newClass = NewClass()"; ! // checkAssistClass(docStr, moduleName, nProps,-1,0, "NewClass", false); // ! // //same as before... different sel ! // docStr = ""+ ! // "from testAssist import assist\n" + //30 chars ! // "assist.Ignore(NewClass(a,b)) "; //from 14 to +13 ! // checkAssistClass(docStr, moduleName, nProps,30+14,13, "NewClass", true); // } // --- 113,142 ---- // */ // public void testAssistClass() throws BadLocationException { ! // String docStr = ""+ ! // "from testAssist import assist\n" + ! // "assist.NewClass(a,b)"; ! // String moduleName = "testAssist.assist"; ! // int nProps = 1; ! // assist = new AssistCreateClassInModule(); ! // checkAssistClass(docStr, moduleName, nProps,-1,0, "NewClass", true); ! // // ! // nProps = 1; ! // moduleName = ""; ! // docStr = ""+ ! // "from testAssist import assist\n" + ! // "newClass = NewClass(a,b)"; ! // checkAssistClass(docStr, moduleName, nProps,-1,0, "NewClass", true); // ! // docStr = ""+ ! // "from testAssist import assist\n" + ! // "newClass = NewClass()"; ! // checkAssistClass(docStr, moduleName, nProps,-1,0, "NewClass", false); // ! // //same as before... different sel ! // docStr = ""+ ! // "from testAssist import assist\n" + //30 chars ! // "assist.Ignore(NewClass(a,b)) "; //from 14 to +13 ! // checkAssistClass(docStr, moduleName, nProps,30+14,13, "NewClass", true); // } // *************** *** 152,180 **** // selStart = docStr.length(); // Document doc = new Document(docStr); ! // PySelection ps = new PySelection(doc, new TextSelection(doc, selStart, selLength)); // String sel = PyAction.getLineWithoutComments(ps); // ! // assertEquals(true, assist.isValid(ps, sel, null, selStart)); ! // List props = assist.getProps(ps, null, null, nature, null, selStart); // assertEquals(nProps, props.size()); ! // SourceModuleProposal p = (SourceModuleProposal) props.get(0); ! // ! // String res = "\n" + ! // "class NewClass(object):\n" + ! // " '''\n"+ ! // " '''\n"+ ! // " \n"; ! // ! // if (hasParams){ ! // res += ""+ ! // " def __init__(self, a, b):\n"+ ! // " '''\n"+ ! // " @param a:\n"+ ! // " @param b:\n"+ ! // " '''\n"+ ! // " "; ! // } ! // ! // assertEquals(res, p.getReplacementStr()); // assertEquals(moduleName, p.module.getName()); // assertTrue(p.getDisplayString().indexOf(tok) != -1); --- 152,180 ---- // selStart = docStr.length(); // Document doc = new Document(docStr); ! // PySelection ps = new PySelection(doc, new TextSelection(doc, selStart, selLength)); // String sel = PyAction.getLineWithoutComments(ps); // ! // assertEquals(true, assist.isValid(ps, sel, null, selStart)); ! // List props = assist.getProps(ps, null, null, nature, null, selStart); // assertEquals(nProps, props.size()); ! // SourceModuleProposal p = (SourceModuleProposal) props.get(0); ! // ! // String res = "\n" + ! // "class NewClass(object):\n" + ! // " '''\n"+ ! // " '''\n"+ ! // " \n"; ! // ! // if (hasParams){ ! // res += ""+ ! // " def __init__(self, a, b):\n"+ ! // " '''\n"+ ! // " @param a:\n"+ ! // " @param b:\n"+ ! // " '''\n"+ ! // " "; ! // } ! // ! // assertEquals(res, p.getReplacementStr()); // assertEquals(moduleName, p.module.getName()); // assertTrue(p.getDisplayString().indexOf(tok) != -1); *************** *** 187,215 **** // public void testAssistMethodInClass() throws BadLocationException { // assist = new AssistCreateMethodInClass(); ! // String d = ""+ ! // "from testAssist import assist\n" + ! // "ex = assist.ExistingClass()\n" + ! // "ex.newMethod(c,d)"; // ! // Document doc = new Document(d); ! // PySelection ps = new PySelection(doc, new TextSelection(doc, d.length(), 0)); // String sel = PyAction.getLineWithoutComments(ps); // ! // assertEquals(true, assist.isValid(ps, sel, null, d.length())); ! // List props = assist.getProps(ps, null, null, nature, null, d.length()); ! // assertEquals(1, props.size()); ! // SourceModuleProposal p = (SourceModuleProposal) props.get(0); ! // ! // String res = "\n" + ! // " def newMethod(self, c, d):\n"+ ! // " '''\n"+ ! // " @param c:\n"+ ! // " @param d:\n"+ ! // " '''\n"+ ! // " "; ! // assertEquals(res, p.getReplacementStr()); ! // assertEquals("testAssist.assist", p.module.getName()); ! // assertEquals("ExistingClass", p.definition.value); ! // assertEquals(SourceModuleProposal.ADD_TO_LAST_CLASS_LINE, p.addTo); // assertTrue(p.getDisplayString().indexOf("newMethod") != -1); // } --- 187,215 ---- // public void testAssistMethodInClass() throws BadLocationException { // assist = new AssistCreateMethodInClass(); ! // String d = ""+ ! // "from testAssist import assist\n" + ! // "ex = assist.ExistingClass()\n" + ! // "ex.newMethod(c,d)"; // ! // Document doc = new Document(d); ! // PySelection ps = new PySelection(doc, new TextSelection(doc, d.length(), 0)); // String sel = PyAction.getLineWithoutComments(ps); // ! // assertEquals(true, assist.isValid(ps, sel, null, d.length())); ! // List props = assist.getProps(ps, null, null, nature, null, d.length()); ! // assertEquals(1, props.size()); ! // SourceModuleProposal p = (SourceModuleProposal) props.get(0); ! // ! // String res = "\n" + ! // " def newMethod(self, c, d):\n"+ ! // " '''\n"+ ! // " @param c:\n"+ ! // " @param d:\n"+ ! // " '''\n"+ ! // " "; ! // assertEquals(res, p.getReplacementStr()); ! // assertEquals("testAssist.assist", p.module.getName()); ! // assertEquals("ExistingClass", p.definition.value); ! // assertEquals(SourceModuleProposal.ADD_TO_LAST_CLASS_LINE, p.addTo); // assertTrue(p.getDisplayString().indexOf("newMethod") != -1); // } Index: AssistAssignTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/tests/org/python/pydev/editor/correctionassist/heuristics/AssistAssignTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AssistAssignTest.java 30 Aug 2007 01:26:49 -0000 1.7 --- AssistAssignTest.java 28 Sep 2008 12:45:42 -0000 1.8 *************** *** 44,48 **** private static final boolean DEBUG = false; ! private AssistAssign assist; public static void main(String[] args) { --- 44,48 ---- private static final boolean DEBUG = false; ! private AssistAssign assist; public static void main(String[] args) { *************** *** 74,89 **** public void testSimple() throws BadLocationException { ! String d = ""+ ! "from testAssist import assist\n" + ! "assist.NewMethod(a,b)"; ! Document doc = new Document(d); ! PySelection ps = new PySelection(doc, new TextSelection(doc, d.length(), 0)); String sel = PyAction.getLineWithoutComments(ps); ! assertEquals(true, assist.isValid(ps, sel, null, d.length())); ! List<ICompletionProposal> props = assist.getProps(ps, null, null, null, null, d.length()); ! assertEquals(2, props.size()); } --- 74,89 ---- public void testSimple() throws BadLocationException { ! String d = ""+ ! "from testAssist import assist\n" + ! "assist.NewMethod(a,b)"; ! Document doc = new Document(d); ! PySelection ps = new PySelection(doc, new TextSelection(doc, d.length(), 0)); String sel = PyAction.getLineWithoutComments(ps); ! assertEquals(true, assist.isValid(ps, sel, null, d.length())); ! List<ICompletionProposal> props = assist.getProps(ps, null, null, null, null, d.length()); ! assertEquals(2, props.size()); } *************** *** 270,276 **** for (ICompletionProposal proposal : props) { ! if(DEBUG){ ! System.out.println(proposal.getDisplayString()); ! } if(proposal.getDisplayString().equals(string)){ return; --- 270,276 ---- for (ICompletionProposal proposal : props) { ! if(DEBUG){ ! System.out.println(proposal.getDisplayString()); ! } if(proposal.getDisplayString().equals(string)){ return; |