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")])
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")
def testProxyNoInterfaces(self): with self.assertRaises(TypeError): proxy = _jpype._JProxy(None, None, tuple())
def testProxyInitBad3(self): with self.assertRaises(TypeError): _jpype._JProxy(None, None, tuple([None, None]))
def testProxyInitBad2(self): with self.assertRaises(TypeError): _jpype._JProxy(None, None, None)
def f(): _jpype._JProxy(None, [JClass("java.io.Serializable")])