Package org.python.core

Examples of org.python.core.PySet.toArray()


    public static void testPySetAsJavaSet() {
        PySet s = new PySet();
        String v = "value";
        check(s.add(v));// Add a String as it should be wrapped in PyString
        check(!s.add(v));
        String[] asArray = (String[])s.toArray(new String[0]);// The array type should be the same
        // and it should be resized properly
        check(asArray.length == 1);
        check(asArray[0] == v);
        Object[] naiveArray = s.toArray();
        check(naiveArray.length == 1);
View Full Code Here


        check(!s.add(v));
        String[] asArray = (String[])s.toArray(new String[0]);// The array type should be the same
        // and it should be resized properly
        check(asArray.length == 1);
        check(asArray[0] == v);
        Object[] naiveArray = s.toArray();
        check(naiveArray.length == 1);
        check(naiveArray[0] == v);
        // Add a Random as it should be wrapped in a generic PyObject; go through addAll to give it
        // a little exercise
        Random rand = new Random();
View Full Code Here

        // Add a Random as it should be wrapped in a generic PyObject; go through addAll to give it
        // a little exercise
        Random rand = new Random();
        check(s.addAll(Generic.list(rand)));
        check(!s.addAll(Generic.list(rand, v)));
        naiveArray = s.toArray();
        check(naiveArray.length == 2);
        for (Object object : naiveArray) {
            if (object instanceof String) {
                check(object == v);
            } else {
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.