Commits

Anonymous committed 4aa893c

Added tests and changed implementation of __ne__

Comments (0)

Files changed (3)

+2002-10-22  Bill Bumgarner  <bbum@codefab.com>
+	* Added basic unit tests to objc.
+	* Implemented __ne__ in terms of isEqual_ (not isNotEqual_).
+	* Added unit test that tests that an object is equal to itself.
+
 2002-10-18  Bill Bumgarner  <bbum@codefab.com>
 	* Fixed the -dealloc method in OC_PythonDictionary.
 	* Disabled gc in objc's __init__.py (I thought we had done this in

pyobjc/Lib/objc/_convenience.py

 def __eq__2(self, other):
 	return self.isEqual_(other) != 0
 def __ne__(self, other):
-	return self.isNotEqual_(other) != 0
+	return not (self.isEqual_(other) != 0)
 def __gt__(self, other):
 	return self.isGreaterThan_(other) != 0
 def __ge__(self, other):

pyobjc/Lib/objc/test/test_objc.py

         anInstance = objc.runtime.NSObject.new()
         self.assert_( anInstance, "Failed to instantiate an instance" )
         self.assert_( isinstance( anInstance, objc.runtime.NSObject ), "Instantiated object not an instance of NSObject." )
+        self.assert_( anInstance.isEqual_( anInstance ), "Instance !isEqual: to itself." )
 
 class Test_method_invocation(unittest.TestCase):
     def setUp(self):