diff test_pymonkey.py @ 22:988a8998c75f

JS objects reflected into Python are now identity-preserving, though the implementation for this is pretty bad right now.
author Atul Varma <varmaa@toolness.com>
date Sun, 28 Jun 2009 21:49:07 -0700
parents abede8af8cf5
children 74b7ad049542
line wrap: on
line diff
--- a/test_pymonkey.py	Sun Jun 28 20:40:18 2009 -0700
+++ b/test_pymonkey.py	Sun Jun 28 21:49:07 2009 -0700
@@ -9,6 +9,16 @@
         cx.init_standard_classes(obj)
         return cx.evaluate_script(obj, code, '<string>', 1)
 
+    def testObjectIsIdentityPreserving(self):
+        cx = pymonkey.Runtime().new_context()
+        obj = cx.new_object()
+        cx.init_standard_classes(obj)
+        cx.evaluate_script(obj, 'foo = {bar: 1}', '<string>', 1)
+        self.assertTrue(isinstance(cx.get_property(obj, "foo"),
+                                   pymonkey.Object))
+        self.assertTrue(cx.get_property(obj, "foo") is
+                        cx.get_property(obj, "foo"))
+
     def testObjectGetattrWorks(self):
         cx = pymonkey.Runtime().new_context()
         obj = cx.new_object()