Commits

Bob Ippolito  committed 8777035

TEST: [ 1107823 ] Key-Value Observing doesn't work for 'manual' properties

this currently fails:
PyKeyValueCoding_10_3.testPythonConvention

  • Participants
  • Parent commits 7e07251
  • Branches pyobjc-ancient

Comments (0)

Files changed (1)

File Lib/objc/test/test_keyvalue.py

     def __init__(self):
         self.key3 = 3
         self._key4 = u"4"
+        self._pythonConvention = u'BAD'
+        self._pythonConventionValue = u'GOOD'
         self.__private = u'private'
 
     def addMultiple(self):
         self.multiple.level2.level3.keyA = u"hello"
         self.multiple.level2.level3.keyB = u"world"
 
+    def pythonConvention(self):
+        return self._pythonConventionValue
+
+    def setPythonConvention_(self, value):
+        self._pythonConventionValue = value
+
     def getKey1(self):
         return 1
 
         self.assertEquals(STUB.keyValue_forObject_key_(DO_VALUEFORKEY, o, u"key3"), 3)
         self.assertEquals(STUB.keyValue_forObject_key_(DO_VALUEFORKEY, o, u"key4"), u"4")
         self.assertEquals(STUB.keyValue_forObject_key_(DO_VALUEFORKEY, o, u"multiple"), o.multiple)
+        self.assertEquals(STUB.keyValue_forObject_key_(DO_VALUEFORKEY, o, u"pythonConvention"), u'GOOD')
 
         self.assertRaises(KeyError, STUB.keyValue_forObject_key_, DO_VALUEFORKEY, o, u"nokey")
 
     # 'takeValue:forKey: u', test these as wel.
 
     class PyKeyValueCoding_10_3 (unittest.TestCase):
+        def testPythonConvention(self):
+            o = KeyValueClass2()
+
+            self.assertEquals(o._pythonConvention, u'BAD')
+            self.assertEquals(o.pythonConvention(), u'GOOD')
+            self.assertEquals(o._pythonConventionValue, u'GOOD')
+            self.assertEquals(STUB.keyValue_forObject_key_(DO_VALUEFORKEY, o, u"pythonConvention"), u'GOOD')
+            STUB.setKeyValue_forObject_key_value_(DO_SETVALUE_FORKEY, o, u'pythonConvention', u'CHANGED')
+            self.assertEquals(STUB.keyValue_forObject_key_(DO_VALUEFORKEY, o, u"pythonConvention"), u'CHANGED')
+            self.assertEquals(o._pythonConvention, u'BAD')
+            self.assertEquals(o.pythonConvention(), u'CHANGED')
+            self.assertEquals(o._pythonConventionValue, u'CHANGED')
+
+
         def testSetValueForKey(self):
             o = KeyValueClass2()