Commits

Ronald Oussoren  committed 1c8fc00

Test that the addressbook framework can be used.

  • Participants
  • Parent commits 6a02217

Comments (0)

Files changed (1)

File pyobjc/Lib/AddressBook/test/test_loaded.py

+"""
+AddressBook doesn't add 'interesting' behaviour, just check that the 
+module loaded correctly.
+"""
+
+import unittest
+import AddressBook
+import objc
+
+class ABTest (unittest.TestCase):
+
+    def testConstants(self):
+        # Test one string and one integer, to check if the constant-extraction
+        # script worked.
+        self.assert_(hasattr(AddressBook, 'kABMultiDictionaryProperty'))
+        self.assert_(hasattr(AddressBook, 'kABPhoneMainLabel'))
+
+        self.assertEquals(AddressBook.kABMultiDictionaryProperty, 262)
+        self.assertEquals(AddressBook.kABPhoneMainLabel, '_$!<Main>!$_')
+
+    def testClasses(self):
+        # Check that we loaded the AddressBook framework by looking for a
+        # class that should exist
+        self.assert_(hasattr(AddressBook, 'ABPerson'))
+        self.assert_(isinstance(AddressBook.ABPerson, objc.objc_class))
+
+if __name__ == "__main__":
+    unittest.main()