Examples of PyDataDescr


Examples of org.python.core.PyDataDescr

        assertTrue(instance.implementsDescrSet());
        assertFalse(instance.implementsDescrDelete());
    }

    public void testFieldSetter() throws Exception {
        PyDataDescr instance = makeDescriptor(new DescSetup() {

            public void setup(DescriptorExposer de) {
                de.addFieldGetter("toStringVal", STRING);
                de.addFieldSetter("toStringVal", STRING);
            }
        });
        instance.__set__(se, Py.newString(NEW_VAL));
        assertEquals(NEW_VAL, se.toString());
        assertTrue(instance.implementsDescrSet());
        assertFalse(instance.implementsDescrDelete());
    }
View Full Code Here

Examples of org.python.core.PyDataDescr

        assertTrue(instance.implementsDescrSet());
        assertFalse(instance.implementsDescrDelete());
    }

    public void testMethodDel() throws Exception {
        PyDataDescr instance = makeDescriptor(new DescSetup() {

            public void setup(DescriptorExposer de) {
                de.addMethodGetter("toString", RETURN_STRING_DESCRIPTOR);
                de.addMethodDeleter("deleteToString", "()V");
            }
        });
        instance.__delete__(se);
        assertNull(se.toString());
        assertTrue(instance.implementsDescrDelete());
    }
View Full Code Here

Examples of org.python.core.PyDataDescr

                                                         ice.getBytecode());
        PyObject simp = (PyObject)doctoredSimple.newInstance();
        PyBuiltinCallable func = MethodExposerTest.instantiate(simple_method, "invisible");
        PyBuiltinCallable bound = func.bind(simp);
        bound.__call__();
        PyDataDescr desc = (PyDataDescr)tostringDesc.newInstance();
        desc.setType(simp.getType());
        assertEquals(doctoredSimple.getField("toStringVal").get(simp),
                     desc.__get__(simp, PyType.fromClass(doctoredSimple)).toString());
        assertEquals(desc.__getattr__("__doc__"), new PyString("tostring docs"));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.