Commits

Ronald Oussoren committed e580a70

Don't use NSIsFreedObject in our unittests, that function causes a deprication
warning.

Comments (0)

Files changed (1)

Lib/objc/test/test_bundleFunctions.py

 import objc
 import Foundation
 import unittest
+import os
 
 NSObject = objc.lookUpClass('NSObject')
 
     return ''.join(args)
 
 FUNCTIONS=[
+    ( u'NSHomeDirectory', S(objc._C_ID)),
     ( u'NSIsFreedObject', S(objc._C_NSBOOL, objc._C_ID) ),
     ( u'NSCountFrames', S(objc._C_UINT) ),
+    ( u'NSClassFromString', S(objc._C_CLASS, objc._C_ID) ),
 ]
 
 class TestBundleFunctions (unittest.TestCase):
 
         self.assert_('NSIsFreedObject' in d)
         self.assert_('NSCountFrames' in d)
+        self.assert_('NSHomeDirectory' in d)
 
-        fn = d[u'NSIsFreedObject']
-        obj = NSObject.alloc().init()
-        value = fn(obj)
-        self.assert_(not value)
+        # Don't use this API, it is unsupported and causes warnings.
+        #fn = d[u'NSIsFreedObject']
+        #obj = NSObject.alloc().init()
+        #value = fn(obj)
+        #self.assert_(not value)
+
+        fn = d[u'NSHomeDirectory']
+        value = fn()
+        self.assertEquals(value, os.path.expanduser('~'))
+
+        fn = d[u'NSClassFromString']
+        value = fn(u'NSObject')
+        self.assert_(value is NSObject)
 
         # Need to look for a different example, NSCountFrames crashes
         # (that is the actual function, not the dynamic wrapper)