| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
import jpype |
| 19 |
import _jpype |
| 20 |
import common |
| 21 |
|
| 22 |
|
| 23 |
class ModuleTestCase2(common.JPypeTestCase): |
| 24 |
def setUp(self): |
| 25 |
common.JPypeTestCase.setUp(self) |
| 26 |
|
| 27 |
def testMonitorOnNull(self): |
| 28 |
value = jpype.JObject(None) |
| 29 |
with self.assertRaises(TypeError): |
| 30 |
_jpype._JMonitor(value) |
| 31 |
|
| 32 |
def testMonitorOnString(self): |
| 33 |
value = jpype.JString("foo") |
| 34 |
with self.assertRaises(TypeError): |
| 35 |
_jpype._JMonitor(value) |
| 36 |
|
| 37 |
def testMonitorOnPrim(self): |
| 38 |
value = jpype.JInt(1) |
| 39 |
with self.assertRaises(TypeError): |
| 40 |
_jpype._JMonitor(value) |
| 41 |
|
| 42 |
def testMonitorInitBad(self): |
| 43 |
with self.assertRaises(TypeError): |
| 44 |
_jpype._JMonitor() |
| 45 |
|
| 46 |
def testMonitorInitBad2(self): |
| 47 |
with self.assertRaises(TypeError): |
| 48 |
_jpype._JMonitor(None) |
| 49 |
|
| 50 |
def testMonitorStr(self): |
| 51 |
obj = jpype.java.lang.Object() |
| 52 |
monitor = _jpype._JMonitor(obj) |
| 53 |
self.assertIsInstance(str(monitor), str) |
| 54 |
|
| 55 |
def testProxyInitBad(self): |
| 56 |
with self.assertRaises(TypeError): |
| 57 |
_jpype._JProxy(None) |
| 58 |
|
| 59 |
def testProxyInitBad2(self): |
| 60 |
with self.assertRaises(TypeError): |
| 61 |
_jpype._JProxy(None, None, None) |
| 62 |
|
| 63 |
def testProxyInitBad3(self): |
| 64 |
with self.assertRaises(TypeError): |
| 65 |
_jpype._JProxy(None, None, tuple([None, None])) |
| 66 |
|
| 67 |
def testProxyNoInterfaces(self): |
| 68 |
with self.assertRaises(TypeError): |
| 69 |
proxy = _jpype._JProxy(None, None, tuple()) |
| 70 |
|
| 71 |
def testValueStr(self): |
| 72 |
obj = jpype.JClass("java.lang.Object")() |
| 73 |
self.assertIsInstance(str(obj), str) |