diff test_pymonkey.py @ 71:9b3f4e53e365

Added context.get_object_private() and an optional private object parameter to context.new_object().
author Atul Varma <varmaa@toolness.com>
date Mon, 27 Jul 2009 21:44:08 -0700
parents b49180c39d0a
children efa0cfe6fc03
line wrap: on
line diff
--- a/test_pymonkey.py	Mon Jul 27 04:47:33 2009 -0700
+++ b/test_pymonkey.py	Mon Jul 27 21:44:08 2009 -0700
@@ -31,6 +31,18 @@
             was_raised = True
         self.assertTrue(was_raised)
 
+    def testGetObjectPrivateWorks(self):
+        class Foo(object):
+            pass
+        pyobj = Foo()
+        cx = pymonkey.Runtime().new_context()
+        obj = cx.new_object(pyobj)
+        pyobj = weakref.ref(pyobj)
+        self.assertEqual(pyobj(), cx.get_object_private(obj))
+        del obj
+        del cx
+        self.assertEqual(pyobj(), None)
+
     def testOperationCallbackIsCalled(self):
         def opcb(cx):
             raise Exception("stop eet!")