[Pydev-cvs] org.python.pydev.parser/tests/org/python/pydev/parser/visitors NodeUtilsTest.java, 1.2
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2008-09-27 19:59:08
|
Update of /cvsroot/pydev/org.python.pydev.parser/tests/org/python/pydev/parser/visitors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20472/tests/org/python/pydev/parser/visitors Modified Files: NodeUtilsTest.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: NodeUtilsTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.parser/tests/org/python/pydev/parser/visitors/NodeUtilsTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NodeUtilsTest.java 8 Apr 2008 23:05:44 -0000 1.2 --- NodeUtilsTest.java 27 Sep 2008 19:58:43 -0000 1.3 *************** *** 12,17 **** public class NodeUtilsTest extends PyParserTestBase { ! public static void main(String[] args) { ! try { NodeUtilsTest test = new NodeUtilsTest(); test.setUp(); --- 12,17 ---- public class NodeUtilsTest extends PyParserTestBase { ! public static void main(String[] args) { ! try { NodeUtilsTest test = new NodeUtilsTest(); test.setUp(); *************** *** 23,99 **** e.printStackTrace(); } ! ! } ! public void testFullRep() throws Exception { SequencialASTIteratorVisitor visitor = SequencialASTIteratorVisitor.create(parseLegalDocStr( ! "print a.b.c().d.__class__")); Iterator<ASTEntry> iterator = visitor.getIterator(); ! iterator.next(); //Module ! iterator.next(); //Print ! ASTEntry entry = iterator.next(); //Attribute ! assertEquals("a.b.c", NodeUtils.getFullRepresentationString(entry.node)); ! visitor = SequencialASTIteratorVisitor.create(parseLegalDocStr( ! "'r.a.s.b'.join('a')")); ! iterator = visitor.getIterator(); ! iterator.next(); //Module ! iterator.next(); //Expr ! entry = iterator.next(); //Attribute ! assertEquals("str.join", NodeUtils.getFullRepresentationString(entry.node)); ! ! visitor = SequencialASTIteratorVisitor.create(parseLegalDocStr( ! "print aa.bbb.cccc[comp.id].hasSimulate")); ! iterator = visitor.getIterator(); ! iterator.next(); //Module ! iterator.next(); //Expr ! entry = iterator.next(); //Attribute ! assertEquals("aa.bbb.cccc", NodeUtils.getFullRepresentationString(entry.node)); ! } ! ! public void testClassEndLine() { ! SimpleNode ast1 = parseLegalDocStr("" + ! "class env:\n" + ! " pass\n" + ! "\n" + ! "#comment\n"); ! ! checkEndLine(ast1, 4); ! ! ast1 = parseLegalDocStr("" + "class env:\n" + " pass\n" + "\n" + ! "if True:\n" + ! " pass\n" + ! "#comment\n"); ! ! checkEndLine(ast1, 2); ! } ! ! public void testGetContextName() { ! SimpleNode ast1 = parseLegalDocStr("" + ! "class env:\n" + ! " pass\n" + ! "\n" + ! "if __name__ == '__main__':\n" + ! " print 'step 1'\n" + ! "\n"); ! ! SimpleNode ast2 = parseLegalDocStr("" + ! "class env:\n" + ! " pass\n" + ! "\n" + ! "if __name__ == '__main__':\n" + ! " print 'step 1'\n" + ! "\n" + ! "#comment"); ! checkEndLine(ast1, 2); checkEndLine(ast2, 2); ! ! assertEquals(null, NodeUtils.getContextName(4, ast1)); assertEquals(null, NodeUtils.getContextName(4, ast2)); } --- 23,99 ---- e.printStackTrace(); } ! ! } ! public void testFullRep() throws Exception { SequencialASTIteratorVisitor visitor = SequencialASTIteratorVisitor.create(parseLegalDocStr( ! "print a.b.c().d.__class__")); Iterator<ASTEntry> iterator = visitor.getIterator(); ! iterator.next(); //Module ! iterator.next(); //Print ! ASTEntry entry = iterator.next(); //Attribute ! assertEquals("a.b.c", NodeUtils.getFullRepresentationString(entry.node)); ! visitor = SequencialASTIteratorVisitor.create(parseLegalDocStr( ! "'r.a.s.b'.join('a')")); ! iterator = visitor.getIterator(); ! iterator.next(); //Module ! iterator.next(); //Expr ! entry = iterator.next(); //Attribute ! assertEquals("str.join", NodeUtils.getFullRepresentationString(entry.node)); ! ! visitor = SequencialASTIteratorVisitor.create(parseLegalDocStr( ! "print aa.bbb.cccc[comp.id].hasSimulate")); ! iterator = visitor.getIterator(); ! iterator.next(); //Module ! iterator.next(); //Expr ! entry = iterator.next(); //Attribute ! assertEquals("aa.bbb.cccc", NodeUtils.getFullRepresentationString(entry.node)); ! } ! ! public void testClassEndLine() { ! SimpleNode ast1 = parseLegalDocStr("" + "class env:\n" + " pass\n" + "\n" + ! "#comment\n"); ! ! checkEndLine(ast1, 4); ! ! ast1 = parseLegalDocStr("" + ! "class env:\n" + ! " pass\n" + ! "\n" + ! "if True:\n" + ! " pass\n" + ! "#comment\n"); ! ! checkEndLine(ast1, 2); ! } ! ! public void testGetContextName() { ! SimpleNode ast1 = parseLegalDocStr("" + ! "class env:\n" + ! " pass\n" + ! "\n" + ! "if __name__ == '__main__':\n" + ! " print 'step 1'\n" + ! "\n"); ! ! SimpleNode ast2 = parseLegalDocStr("" + ! "class env:\n" + ! " pass\n" + ! "\n" + ! "if __name__ == '__main__':\n" + ! " print 'step 1'\n" + ! "\n" + ! "#comment"); ! checkEndLine(ast1, 2); checkEndLine(ast2, 2); ! ! assertEquals(null, NodeUtils.getContextName(4, ast1)); assertEquals(null, NodeUtils.getContextName(4, ast2)); } |