[Pydev-cvs] org.python.pydev.parser/tests/org/python/pydev/parser/prettyprinter PrettyPrinterTest.
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2008-09-27 19:59:23
|
Update of /cvsroot/pydev/org.python.pydev.parser/tests/org/python/pydev/parser/prettyprinter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20472/tests/org/python/pydev/parser/prettyprinter Modified Files: PrettyPrinterTest.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: PrettyPrinterTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.parser/tests/org/python/pydev/parser/prettyprinter/PrettyPrinterTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PrettyPrinterTest.java 13 Jun 2007 00:20:54 -0000 1.2 --- PrettyPrinterTest.java 27 Sep 2008 19:58:44 -0000 1.3 *************** *** 40,50 **** public void testIfs() throws Exception { String s = "" + ! "def method1():\n" + ! " if idx > 2:\n" + ! " print ''\n" + ! " else:\n" + ! " print ''\n" + ! " if idx == 5:\n" + ! " print 'nothing!'\n"; checkPrettyPrintEqual(s); } --- 40,50 ---- public void testIfs() throws Exception { String s = "" + ! "def method1():\n" + ! " if idx > 2:\n" + ! " print ''\n" + ! " else:\n" + ! " print ''\n" + ! " if idx == 5:\n" + ! " print 'nothing!'\n"; checkPrettyPrintEqual(s); } *************** *** 75,85 **** "class MyClass:\n" + " __metaclass__ = MyMeta\n" + ! "print type(foox)\n" + ! "# after print type\n" + ! "class A(object):# on-line\n" + ! " # foo test\n" + ! " def met(self):\n" + ! " print 'A'\n" + ! ""; checkPrettyPrintEqual(str); --- 75,85 ---- "class MyClass:\n" + " __metaclass__ = MyMeta\n" + ! "print type(foox)\n" + ! "# after print type\n" + ! "class A(object):# on-line\n" + ! " # foo test\n" + ! " def met(self):\n" + ! " print 'A'\n" + ! ""; checkPrettyPrintEqual(str); *************** *** 88,96 **** public void testComment5() throws Exception { String str = "" + ! "class CoolApproach(object):\n" + ! " # this tests also a tuple \"special case\"\n" + ! " def foodeco(**arg5):\n" + ! " pass\n" + ! ""; checkPrettyPrintEqual(str); --- 88,96 ---- public void testComment5() throws Exception { String str = "" + ! "class CoolApproach(object):\n" + ! " # this tests also a tuple \"special case\"\n" + ! " def foodeco(**arg5):\n" + ! " pass\n" + ! ""; checkPrettyPrintEqual(str); *************** *** 99,107 **** public void testDecoration() throws Exception { String str = "" + ! "class Foo:\n" + ! " @foodeco(('arg_3',),2,a=2,b=3)\n" + ! " def __init__(self,arg_1,(arg_2,arg_3),arg_4,arg_5):\n" + ! " pass\n" + ! ""; checkPrettyPrintEqual(str); } --- 99,107 ---- public void testDecoration() throws Exception { String str = "" + ! "class Foo:\n" + ! " @foodeco(('arg_3',),2,a=2,b=3)\n" + ! " def __init__(self,arg_1,(arg_2,arg_3),arg_4,arg_5):\n" + ! " pass\n" + ! ""; checkPrettyPrintEqual(str); } *************** *** 109,117 **** public void testComments6() throws Exception { String str = "" + ! "class FooApproach(CoolApproach):\n" + ! " def __init__(self,arg_1,(arg_2,arg_3),*arg_4,**arg_5):\n" + ! " # .. at this point all parameters except for 'arg_3' have been\n" + ! " # copied to object attributes\n" + ! " pass\n" + ""; checkPrettyPrintEqual(str); --- 109,117 ---- public void testComments6() throws Exception { String str = "" + ! "class FooApproach(CoolApproach):\n" + ! " def __init__(self,arg_1,(arg_2,arg_3),*arg_4,**arg_5):\n" + ! " # .. at this point all parameters except for 'arg_3' have been\n" + ! " # copied to object attributes\n" + ! " pass\n" + ""; checkPrettyPrintEqual(str); *************** *** 525,573 **** public void testComment() throws Exception { ! String s = ""+ ! "# comment1\n" + ! "# comment2\n" + ! "# comment3\n" + ! "# comment4\n" + ! "'''str'''\n" + ! ""; ! checkPrettyPrintEqual(s); } public void testStarArgs() throws Exception { ! String s = ""+ ! "def recv(self,*args):\n" + ! " pass\n" + ! ""; ! checkPrettyPrintEqual(s); } public void testListComp() throws Exception { ! String s = ""+ ! "print [x for x in tbinfo]\n" + ! ""; ! checkPrettyPrintEqual(s); } public void testSub() throws Exception { ! String s = ""+ ! "print tbinfo[-1]\n" + ! ""; ! checkPrettyPrintEqual(s); } public void testDel() throws Exception { ! String s = ""+ ! "del foo\n" + ! ""; ! checkPrettyPrintEqual(s); } public void testPar2() throws Exception { ! String s = ""+ ! "def log(self,message):\n" + ! " sys.stderr.write('log: %s' % str(message))\n" + ! ""; ! checkPrettyPrintEqual(s); } --- 525,573 ---- public void testComment() throws Exception { ! String s = ""+ ! "# comment1\n" + ! "# comment2\n" + ! "# comment3\n" + ! "# comment4\n" + ! "'''str'''\n" + ! ""; ! checkPrettyPrintEqual(s); } public void testStarArgs() throws Exception { ! String s = ""+ ! "def recv(self,*args):\n" + ! " pass\n" + ! ""; ! checkPrettyPrintEqual(s); } public void testListComp() throws Exception { ! String s = ""+ ! "print [x for x in tbinfo]\n" + ! ""; ! checkPrettyPrintEqual(s); } public void testSub() throws Exception { ! String s = ""+ ! "print tbinfo[-1]\n" + ! ""; ! checkPrettyPrintEqual(s); } public void testDel() throws Exception { ! String s = ""+ ! "del foo\n" + ! ""; ! checkPrettyPrintEqual(s); } public void testPar2() throws Exception { ! String s = ""+ ! "def log(self,message):\n" + ! " sys.stderr.write('log: %s' % str(message))\n" + ! ""; ! checkPrettyPrintEqual(s); } *************** *** 580,588 **** public void testSimpleFunc() throws Exception { ! String s = ""+ ! "def a():\n" + ! " pass\n" + ! ""; ! checkPrettyPrintEqual(s); } --- 580,588 ---- public void testSimpleFunc() throws Exception { ! String s = ""+ ! "def a():\n" + ! " pass\n" + ! ""; ! checkPrettyPrintEqual(s); } *************** *** 1013,1022 **** public void testYield4() throws Exception { ! String s = ""+ ! "def foo():\n" + ! " yield ((a + b) / 2)#comment1\n" + ! " print 'foo'\n" + ! ""; ! checkPrettyPrintEqual(s); } --- 1013,1022 ---- public void testYield4() throws Exception { ! String s = ""+ ! "def foo():\n" + ! " yield ((a + b) / 2)#comment1\n" + ! " print 'foo'\n" + ! ""; ! checkPrettyPrintEqual(s); } *************** *** 1026,1052 **** } public void testFuncComment() throws Exception { ! String s = ""+ ! "def foo():\n" + ! " #comment0\n" + ! " print 'foo'\n" + ! ""; ! checkPrettyPrintEqual(s); } public void testPrint() throws Exception { ! String s = ""+ ! "print >> a,'foo'\n" + ! ""; ! checkPrettyPrintEqual(s); } public void testPrintComment() throws Exception { ! String s = ""+ ! "def test():#comm1\n" + ! " print >> (a,#comm2\n" + ! " 'foo')#comm3\n" + ! ""; ! checkPrettyPrintEqual(s); } --- 1026,1052 ---- } public void testFuncComment() throws Exception { ! String s = ""+ ! "def foo():\n" + ! " #comment0\n" + ! " print 'foo'\n" + ! ""; ! checkPrettyPrintEqual(s); } public void testPrint() throws Exception { ! String s = ""+ ! "print >> a,'foo'\n" + ! ""; ! checkPrettyPrintEqual(s); } public void testPrintComment() throws Exception { ! String s = ""+ ! "def test():#comm1\n" + ! " print >> (a,#comm2\n" + ! " 'foo')#comm3\n" + ! ""; ! checkPrettyPrintEqual(s); } *************** *** 1087,1094 **** public void testSubscript() throws Exception { ! String s = ""+ ! "print a[0]\n" + ! ""; ! checkPrettyPrintEqual(s); } --- 1087,1094 ---- public void testSubscript() throws Exception { ! String s = ""+ ! "print a[0]\n" + ! ""; ! checkPrettyPrintEqual(s); } *************** *** 1128,1142 **** public void testDocStrings() throws Exception { ! String s = ""+ ! "class Class1:\n" + ! " '''docstring1'''\n" + ! " a = '''str1'''\n" + ! " def met1(self,a):\n" + ! " '''docstring2\n" + ! " foo\n" + ! " '''\n" + ! " pass\n" + ""; ! checkPrettyPrintEqual(s); } --- 1128,1142 ---- public void testDocStrings() throws Exception { ! String s = ""+ ! "class Class1:\n" + ! " '''docstring1'''\n" + ! " a = '''str1'''\n" + ! " def met1(self,a):\n" + ! " '''docstring2\n" + ! " foo\n" + ! " '''\n" + ! " pass\n" + ""; ! checkPrettyPrintEqual(s); } *************** *** 1215,1255 **** } public void testIfElse2() throws Exception { ! String s = ""+ ! "if a:\n"+ ! " a = 1#comment1\n"+ ! "elif b:\n"+ ! " b = 2#comment2\n"+ ! "elif c:\n"+ ! " c = 3#comment3\n"+ ! "else:\n"+ ! " d = 4#comment4\n"; ! checkPrettyPrintEqual(s); } public void testIfElse3() throws Exception { ! String s = ! "#commentbefore\n"+ //1 ! "if a:#commentIf\n"+ //2 ! " a = 1\n"+ //3 ! "elif b:#commentElif\n"+ //4 ! " b = 2\n"+ //5 ! "elif c:\n"+ //6 ! " c = 3\n"+ //7 ! "else:#commentElse\n"+ //8 ! " d = 4\n" + //9 ! "outOfIf = True\n"; //10 ! checkPrettyPrintEqual(s); } public void testCommentAndIf() throws Exception { String s = "" + ! "def initiate_send():\n" + ! " if 10:\n" + ! " # try to send the buffer\n" + ! " try:\n" + ! " num_sent = 10\n" + ! " except:\n" + ! " pass\n" + ! ""; checkPrettyPrintEqual(s); } --- 1215,1255 ---- } public void testIfElse2() throws Exception { ! String s = ""+ ! "if a:\n"+ ! " a = 1#comment1\n"+ ! "elif b:\n"+ ! " b = 2#comment2\n"+ ! "elif c:\n"+ ! " c = 3#comment3\n"+ ! "else:\n"+ ! " d = 4#comment4\n"; ! checkPrettyPrintEqual(s); } public void testIfElse3() throws Exception { ! String s = ! "#commentbefore\n"+ //1 ! "if a:#commentIf\n"+ //2 ! " a = 1\n"+ //3 ! "elif b:#commentElif\n"+ //4 ! " b = 2\n"+ //5 ! "elif c:\n"+ //6 ! " c = 3\n"+ //7 ! "else:#commentElse\n"+ //8 ! " d = 4\n" + //9 ! "outOfIf = True\n"; //10 ! checkPrettyPrintEqual(s); } public void testCommentAndIf() throws Exception { String s = "" + ! "def initiate_send():\n" + ! " if 10:\n" + ! " # try to send the buffer\n" + ! " try:\n" + ! " num_sent = 10\n" + ! " except:\n" + ! " pass\n" + ! ""; checkPrettyPrintEqual(s); } |