Skip to content

Commit 2fe1970

Browse files
committed
Start on test bench.
1 parent 56f832f commit 2fe1970

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2002
-206
lines changed

native/jpype_module/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<dependency>
1010
<groupId>org.testng</groupId>
1111
<artifactId>testng</artifactId>
12-
<version>6.8.1</version>
12+
<version>7.3.0</version>
1313
<scope>test</scope>
1414
</dependency>
1515
<dependency>

native/jpype_module/src/main/java/org/jpype/bridge/Backend.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public interface Backend
9595
// Delete an item from a Python mapping object by key.
9696
PyObject delByObject(PyMapping obj, Object key);
9797

98-
public PyObject delattrReturn(PyObject obj, Object key);
98+
PyObject delattrReturn(PyObject obj, Object key);
9999

100100
// Delete an attribute from a Python object by name.
101101
void delattrString(Object obj, CharSequence attrName);
@@ -124,6 +124,8 @@ public interface Backend
124124
// Get the signature of a Python callable.
125125
PyObject getSignature(PyCallable obj);
126126

127+
PyObject getattrDefault(PyObject obj, Object key);
128+
127129
// Get an attribute from a Python object by key.
128130
PyObject getattrObject(PyObject obj, Object key);
129131

@@ -240,14 +242,22 @@ public interface Backend
240242
// Create a Python `int` from a long value.
241243
PyInt newInt(long value);
242244

245+
// Create an empty Python `list`.
246+
PyList newList();
247+
243248
// Create a Python `list` from an array of objects.
244249
PyList newListFromArray(Object... elements);
245250

246251
// Create a Python `list` from an iterable.
247252
<T> PyList newListFromIterable(Iterable<T> iterable);
248253

254+
// Create an empty Python `set`.
255+
PySet newSet();
256+
249257
// Create a Python `set` from an iterable.
250-
PySet newSet(Iterable<?> iterable);
258+
PySet newSetFromIterable(Iterable<?> iterable);
259+
260+
public PyTuple newTuple();
251261

252262
// Create a Python `tuple` from an array of objects.
253263
<T> PyTuple newTupleFromArray(T... elements);
@@ -309,6 +319,10 @@ public interface Backend
309319
// Get the `__dict__` attribute of a Python object.
310320
PyDict vars(Object obj);
311321

322+
public PyZip zipFromArray(PyObject[] objects);
323+
324+
public PyZip zipFromArray(Object[] objects);
325+
312326
// Create a Python `zip` object from multiple objects.
313-
<T> PyZip zip(T... objects);
327+
<T> PyZip zipFromIterable(T... objects);
314328
}

native/jpype_module/src/main/java/org/jpype/bridge/Context.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.jpype.bridge;
1717

18+
import python.lang.PyBuiltIn;
1819
import python.lang.PyDict;
1920
import python.lang.PyObject;
2021
import python.protocol.PyMapping;
@@ -30,7 +31,7 @@
3031
* private scope object.
3132
*
3233
*/
33-
public class Context extends BuiltIn
34+
public class Context extends PyBuiltIn
3435
{
3536

3637
public final PyDict globalsDict;

native/jpype_module/src/main/java/org/jpype/bridge/Interpreter.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ public List<String> getModulePaths()
100100
return modulePaths;
101101
}
102102

103+
public boolean isStarted()
104+
{
105+
return backend!=null;
106+
}
107+
103108
/**
104109
* Start the interpreter.Any configuration actions must have been completed
105110
* before the interpreter is started.
@@ -108,7 +113,7 @@ public List<String> getModulePaths()
108113
*
109114
* @param args
110115
*/
111-
public void start(String[] args)
116+
public void start(String... args)
112117
{
113118
// Once builtin is set internally then we can't call create again.
114119
if (Interpreter.backend != null)

0 commit comments

Comments
 (0)