1from __future__ import absolute_import, unicode_literals 2import objc 3from . import fnd as Foundation 4from PyObjCTools.TestSupport import * 5 6class TestBundleVariables (TestCase): 7 def setUp(self): 8 self.bundle = Foundation.NSBundle.bundleForClass_(Foundation.NSBundle) 9 10 def testStrings(self): 11 d = {} 12 objc.loadBundleVariables(self.bundle, d, [ 13 ('NSAppleScriptErrorMessage', b'@'), 14 ('NSBundleDidLoadNotification', b'@'), 15 ]) 16 17 self.assertIn('NSBundleDidLoadNotification', d) 18 self.assertIn('NSAppleScriptErrorMessage', d) 19 20 self.assertIsInstance(d['NSAppleScriptErrorMessage'], objc.pyobjc_unicode) 21 self.assertIsInstance(d['NSBundleDidLoadNotification'], objc.pyobjc_unicode) 22 23 def testSimple(self): 24 d = {} 25 objc.loadBundleVariables(self.bundle, d, [ 26 ('NSDebugEnabled', objc._C_NSBOOL), 27 ('NSFoundationVersionNumber', objc._C_DBL), 28 ]) 29 30 self.assertIn('NSDebugEnabled', d) 31 self.assertIn('NSFoundationVersionNumber', d) 32 33 self.assertIsInstance(d['NSFoundationVersionNumber'], float) 34 self.assertIsInstance(d['NSDebugEnabled'], int) 35 36 37if __name__ == "__main__": 38 main() 39