| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
import jpype |
| 19 |
import common |
| 20 |
|
| 21 |
|
| 22 |
class ClosedTestCase(common.JPypeTestCase): |
| 23 |
def setUp(self): |
| 24 |
common.JPypeTestCase.setUp(self) |
| 25 |
|
| 26 |
def testObjects(self): |
| 27 |
from jpype import java |
| 28 |
|
| 29 |
s = java.lang.String('foo') |
| 30 |
s._allowed = 1 |
| 31 |
try: |
| 32 |
s.forbidden = 1 |
| 33 |
except AttributeError: |
| 34 |
pass |
| 35 |
else: |
| 36 |
raise AssertionError("AttributeError not raised") |
| 37 |
|
| 38 |
def testArrays(self): |
| 39 |
s = jpype.JArray(jpype.JInt)(5) |
| 40 |
|
| 41 |
s._allowed = 1 |
| 42 |
try: |
| 43 |
|
| 44 |
s.forbidden = 1 |
| 45 |
except AttributeError: |
| 46 |
pass |
| 47 |
else: |
| 48 |
raise AssertionError("AttributeError not raised") |
| 49 |
|
| 50 |
def testStatic(self): |
| 51 |
static = jpype.JClass('jpype.objectwrapper.StaticTest') |
| 52 |
self.assertEqual(static.i, 1) |
| 53 |
self.assertEqual(static.d, 1.2345) |
| 54 |
self.assertEqual(static.s, "hello") |