def testOCLeak2(self): self.deleted = 0 self.object.idVar = OCBase.alloc().init_( lambda: setattr(self, 'deleted', 1)) del self.object objc.recycleAutoreleasePool() self.assertEquals(self.deleted, 1)
def testLeak(self): # Check that plain python objects are correctly released when # they are no longer the value of an attribute self.deleted = 0 self.object.idVar = Base(lambda: setattr(self, 'deleted', 1)) self.object.idVar = None objc.recycleAutoreleasePool() self.assertEquals(self.deleted, 1)
def testOCLeak(self): # Check that Objective-C objects are correctly released when # they are no longer the value of an attribute self.deleted = 0 self.object.idVar = OCBase.alloc().init_(lambda : setattr(self, 'deleted', 1)) self.object.idVar = None objc.recycleAutoreleasePool() self.assertEquals(self.deleted, 1)
def testLeak(self): # Check that plain python objects are correctly released when # they are no longer the value of an attribute self.deleted = 0 self.object.idVar = Base(lambda : setattr(self, 'deleted', 1)) self.object.idVar = None objc.recycleAutoreleasePool() self.assertEquals(self.deleted, 1)
def testBasic(self): # This is mostly a regression tests, the function used to crash on # this... if objc.platform != 'MACOSX': return s = NSLocalizedString(u"hello world", u"") objc.recycleAutoreleasePool() self.assertEquals (s, u"hello world")
def testBasic(self): # This is mostly a regression tests, the function used to crash on # this... if objc.platform != 'MACOSX': return s = NSLocalizedString(u"hello world", u"") objc.recycleAutoreleasePool() self.assertEquals(s, u"hello world")
def testOCLeak(self): # Check that Objective-C objects are correctly released when # they are no longer the value of an attribute self.deleted = 0 self.object.idVar = OCBase.alloc().init_( lambda: setattr(self, 'deleted', 1)) self.object.idVar = None objc.recycleAutoreleasePool() self.assertEquals(self.deleted, 1)
self.assertSameDictionaryContents(originalNSDictionary, convertedNSDictionary) self.assertSameDictionaryContents(convertedNSDictionary, aPythonDictionary) def testIntegerConversion(self): x = NSArray.arrayWithArray_([1,2,3,4]) y = pythonCollectionFromPropertyList(x) z = propertyListFromPythonCollection(y) self.assertSameArrayContents(x,y) self.assertSameArrayContents(x,z) self.assertSameArrayContents(z,y) def testHelpers(self): def conversionHelper(anObject): return anObject self.assertRaises(TypeError, propertyListFromPythonCollection, { u'1' : type([]) }) propertyListFromPythonCollection({u'1' : type([])}, conversionHelper) d = NSDictionary.dictionaryWithDictionary_( {u'1' : NSObject.alloc().init() }) self.assertRaises(TypeError, pythonCollectionFromPropertyList, d) pythonCollectionFromPropertyList(d, conversionHelper) if __name__ == '__main__': try: unittest.main( ) except SystemExit : pass objc.recycleAutoreleasePool()
def testLeak2(self): self.deleted = 0 self.object.idVar = Base(lambda: setattr(self, 'deleted', 1)) del self.object objc.recycleAutoreleasePool() self.assertEquals(self.deleted, 1)
def testIntegerConversion(self): x = NSArray.arrayWithArray_([1, 2, 3, 4]) y = pythonCollectionFromPropertyList(x) z = propertyListFromPythonCollection(y) self.assertSameArrayContents(x, y) self.assertSameArrayContents(x, z) self.assertSameArrayContents(z, y) def testHelpers(self): def conversionHelper(anObject): return anObject self.assertRaises(TypeError, propertyListFromPythonCollection, {u'1': type([])}) propertyListFromPythonCollection({u'1': type([])}, conversionHelper) d = NSDictionary.dictionaryWithDictionary_( {u'1': NSObject.alloc().init()}) self.assertRaises(TypeError, pythonCollectionFromPropertyList, d) pythonCollectionFromPropertyList(d, conversionHelper) if __name__ == '__main__': try: unittest.main() except SystemExit: pass objc.recycleAutoreleasePool()
def __del__(self, objc=objc): objc.recycleAutoreleasePool()
def testOCLeak2(self): self.deleted = 0 self.object.idVar = OCBase.alloc().init_(lambda : setattr(self, 'deleted', 1)) del self.object objc.recycleAutoreleasePool() self.assertEquals(self.deleted, 1)
def testLeak2(self): self.deleted = 0 self.object.idVar = Base(lambda : setattr(self, 'deleted', 1)) del self.object objc.recycleAutoreleasePool() self.assertEquals(self.deleted, 1)