コード例 #1
0
ファイル: test_nscoder.py プロジェクト: ivanmolera/Raspberry
 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),
     ])
コード例 #2
0
ファイル: test_nscoder.py プロジェクト: Joey-Lee/pyobjc
 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),
             ])
コード例 #3
0
ファイル: test_threading.py プロジェクト: aosm/pyobjc
    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))
コード例 #4
0
ファイル: test_threading.py プロジェクト: happylaodu/osx-10.9
    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))