Package org.python.pydev.parser.jython.ast

Examples of org.python.pydev.parser.jython.ast.Assign


                "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);
    }
View Full Code Here


                "    pass\n" +
                "GLOBAL_ATTR = 10\n" +
                "";
        Module m = (Module) FastDefinitionsParser.parse(str);
        assertEquals(2, m.body.length);
        Assign assign = ((Assign) m.body[1]);
        assertEquals("GLOBAL_ATTR", ((Name) assign.targets[0]).id);
    }
View Full Code Here

                +
                "\n" +
                "";
        Module m = (Module) FastDefinitionsParser.parse(str);
        assertEquals(3, m.body.length);
        Assign assign = ((Assign) m.body[1]);
        assertEquals("IGNORE", ((Name) assign.targets[0]).id);
    }
View Full Code Here

        System.out.println("OK");
    }

    private void checkSingleGlobalAttr(Module m) {
        assertEquals(1, m.body.length);
        Assign assign = ((Assign) m.body[0]);
        assertEquals("new_a", ((Name) assign.targets[0]).id);
    }
View Full Code Here

        FunctionDef defM2 = (FunctionDef) classDefBar.body[0];
        assertEquals("m2", ((NameTok) (defM2).name).id);
        assertEquals(5, defM2.beginColumn);
        assertEquals(2, defM2.beginLine);

        Assign a = (Assign) defM2.body[0];
        assertEquals("self.a", NodeUtils.getFullRepresentationString(a.targets[0]));
        assertEquals(18, a.beginColumn);
        assertEquals(2, a.beginLine);
    }
View Full Code Here

        FunctionDef defM2 = (FunctionDef) classDefBar.body[0];
        assertEquals("m2", ((NameTok) (defM2).name).id);
        assertEquals(5, defM2.beginColumn);
        assertEquals(2, defM2.beginLine);

        Assign a = (Assign) defM2.body[0];
        assertEquals("self.a", NodeUtils.getFullRepresentationString(a.targets[0]));
        assertEquals(12, a.beginColumn);
        assertEquals(4, a.beginLine);
    }
View Full Code Here

        FunctionDef defM2 = (FunctionDef) classDefBar.body[0];
        assertEquals("m2", ((NameTok) (defM2).name).id);
        assertEquals(5, defM2.beginColumn);
        assertEquals(2, defM2.beginLine);

        Assign a = (Assign) defM2.body[0];
        assertEquals("self.a", NodeUtils.getFullRepresentationString(a.targets[0]));
        assertEquals(15, a.beginColumn);
        assertEquals(4, a.beginLine);
    }
View Full Code Here

        assertEquals(endLine, classes.get(0).endLine);
    }

    public void testFindStmtForNode() throws Exception {
        Module ast = (Module) parseLegalDocStr("a=10;b=20;c=30");
        Assign assign = (Assign) ast.body[1];
        Name b = (Name) assign.targets[0];
        assertSame(assign, NodeUtils.findStmtForNode(ast, b));

        ast = (Module) parseLegalDocStr("a=10\nb=20\nc=30");
        assign = (Assign) ast.body[1];
View Full Code Here

                "print(abstracts)\n" +
                "\n" +
                "";
        SimpleNode ast = parseLegalDocStr(s);
        Module m = (Module) ast;
        Assign a0 = (Assign) m.body[0];
        Assign a1 = (Assign) m.body[1];
        assertTrue(a0.value instanceof Dict);
        SetComp setComp = (SetComp) a1.value;

        assertEquals("name", ((Name) setComp.elt).id);
    }
View Full Code Here

        String s = "" +
                "namespace = {1, 2, 3, 4}\n" +
                "";
        SimpleNode ast = parseLegalDocStr(s);
        Module m = (Module) ast;
        Assign a0 = (Assign) m.body[0];
        assertTrue(a0.value instanceof Set);
        assertEquals("Assign[targets=[Name[id=namespace, ctx=Store, reserved=false]], value="
                +
                "Set[elts=[Num[n=1, type=Int, num=1], Num[n=2, type=Int, num=2], "
                +
                "Num[n=3, type=Int, num=3], Num[n=4, type=Int, num=4]]]]", a0.toString());
    }
View Full Code Here

TOP

Related Classes of org.python.pydev.parser.jython.ast.Assign

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.