[Pydev-cvs] org.python.pydev.parser/tests/org/python/pydev/parser/fastparser FastDefinitionsParser
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2008-07-14 23:02:10
|
Update of /cvsroot/pydev/org.python.pydev.parser/tests/org/python/pydev/parser/fastparser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2393/tests/org/python/pydev/parser/fastparser Modified Files: FastDefinitionsParserTest.java Log Message: Better handling of assign on fast parsing. Index: FastDefinitionsParserTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.parser/tests/org/python/pydev/parser/fastparser/FastDefinitionsParserTest.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FastDefinitionsParserTest.java 6 Jul 2008 13:10:42 -0000 1.6 --- FastDefinitionsParserTest.java 14 Jul 2008 23:02:18 -0000 1.7 *************** *** 29,33 **** FastDefinitionsParserTest test = new FastDefinitionsParserTest(); test.setUp(); ! // test.NotestGlobalAttributesWX(); --- 29,34 ---- FastDefinitionsParserTest test = new FastDefinitionsParserTest(); test.setUp(); ! test.testGlobalAttributes5(); ! test.NotestGlobalAttributesWX(); *************** *** 103,106 **** --- 104,125 ---- } + public void testMultipleAssignAttributes() { + Module m = (Module) FastDefinitionsParser.parse( + "class Bar:\n" + + " ATTRIBUTE1 = ATTRIBUTE2 = 10\n" + + "\n" + + ""); + assertEquals(1, m.body.length); + ClassDef classDef = ((ClassDef)m.body[0]); + assertEquals("Bar", ((NameTok)classDef.name).id); + assertEquals(1, classDef.body.length); + Assign assign = (Assign) classDef.body[0]; + assertEquals(2, assign.targets.length); + Name name = (Name) assign.targets[0]; + assertEquals("ATTRIBUTE1", name.id); + name = (Name) assign.targets[1]; + assertEquals("ATTRIBUTE2", name.id); + } + public void testAttributes2() { *************** *** 165,169 **** " self.ATTRIBUTE0 = 10\n" + //local scope: get it because of self. " self.ATTRIBUTE1 = 10\n" + //local scope: get it because of self. ! " self.ATTRIBUTE2 = 10\n" + //local scope: get it because of self. "\n" + ""); --- 184,188 ---- " self.ATTRIBUTE0 = 10\n" + //local scope: get it because of self. " self.ATTRIBUTE1 = 10\n" + //local scope: get it because of self. ! " self.ATTRIBUTE2 = = 10\n" + //local scope: get it because of self. "\n" + ""); *************** *** 249,252 **** --- 268,284 ---- } + public void testGlobalAttributes5() { + Module m = (Module) FastDefinitionsParser.parse( + "GLOBAL_ATTRIBUTE = 10\n" + + "GLOBAL_ATTRIBUTE2 = 10\n" + + "\n" + + ""); + assertEquals(2, m.body.length); + Assign assign = ((Assign)m.body[0]); + assertEquals("GLOBAL_ATTRIBUTE", ((Name)assign.targets[0]).id); + assign = ((Assign)m.body[1]); + assertEquals("GLOBAL_ATTRIBUTE2", ((Name)assign.targets[0]).id); + } + public void testGlobalAttributes2() { String str = "import new\n" + *************** *** 494,501 **** --- 526,539 ---- " '''_setCallbackInfo(self, PyObject self, PyObject _class)'''\n" + " return _xrc.XmlSubclassFactory__setCallbackInfo(*args, **kwargs)\n" + + " Parent = property(GetParent,doc=\"See `GetParent`\") \n" + + " ParentAsWindow = property(GetParentAsWindow,doc=\"See `GetParentAsWindow`\") \n" + + " Resource = property(GetResource,doc=\"See `GetResource`\") \n" + "_xrc.XmlSubclassFactory_swigregister(XmlSubclassFactory)\n" + "#---------------------------------------------------------------------------\n" + "XML_ELEMENT_NODE = _xrc.XML_ELEMENT_NODE\n" + "XML_ATTRIBUTE_NODE = _xrc.XML_ATTRIBUTE_NODE\n" + + "_xrc.XmlResourceHandler_swigregister(XmlResourceHandler)\n" + + "\n" + + "\n" + "\n" + "\n" + |