Esempio n. 1
0
 def testJPProxy_new(self):
     _jpype.fault("PyJPProxy_new")
     with self.assertRaisesRegex(SystemError, "fault"):
         JProxy("java.io.Serializable", dict={})
     with self.assertRaises(TypeError):
         _jpype._JProxy(None, None)
     with self.assertRaises(TypeError):
         _jpype._JProxy(None, [])
     with self.assertRaises(TypeError):
         _jpype._JProxy(None, [type])
     _jpype.fault("JPProxy::JPProxy")
     with self.assertRaises(SystemError):
         _jpype._JProxy(None, [JClass("java.io.Serializable")])
     _jpype._JProxy(None, [JClass("java.io.Serializable")])
Esempio n. 2
0
    def __new__(cls, intf, dict=None, inst=None, convert=False):
        # Convert the interfaces
        actualIntf = _convertInterfaces([intf])

        # Verify that one of the options has been selected
        if dict is not None and inst is not None:
            raise TypeError("Specify only one of dict and inst")

        if dict is not None:
            return _jpype._JProxy(_JFromDict(dict), actualIntf, convert)

        if inst is not None:
            return _jpype._JProxy.__new__(cls, inst, actualIntf, convert)

        raise TypeError("a dict or inst must be specified")
Esempio n. 3
0
 def testProxyNoInterfaces(self):
     with self.assertRaises(TypeError):
         proxy = _jpype._JProxy(None, None, tuple())
Esempio n. 4
0
 def testProxyInitBad3(self):
     with self.assertRaises(TypeError):
         _jpype._JProxy(None, None, tuple([None, None]))
Esempio n. 5
0
 def testProxyInitBad2(self):
     with self.assertRaises(TypeError):
         _jpype._JProxy(None, None, None)
Esempio n. 6
0
 def f():
     _jpype._JProxy(None, [JClass("java.io.Serializable")])