def testEncoding(self): coder = MyCoder.alloc().init() o = PyObjC_TestClass4.alloc().init() o.encodeWithCoder_(coder) self.assertEqual(coder.coded, [ ("value", b"d", 1.5), ("array", b"i", 4, (3, 4, 5, 6)), ("bytes", b"hello world", 11), ])
def testEncoding(self): coder = MyCoder.alloc().init() o = PyObjC_TestClass4.alloc().init() o.encodeWithCoder_(coder) self.assertEquals(coder.coded, [ ("value", "d", 1.5), ("array", "i", 4, (3,4,5,6)), ("bytes", "hello world", 11), ])
def testCalling(self): class Dummy: pass class PyObjCTestCalling (NSObject) : def call(self): return Dummy() my = PyObjC_TestClass4.alloc().init() cb = PyObjCTestCalling.alloc().init() NSThread.detachNewThreadSelector_toTarget_withObject_( 'runThread:', my, cb) time.sleep(2) retval = my.returnObject() self.assert_(isinstance(retval, Dummy))