diff test_pymonkey.py @ 17:0812422ec99e

Added a context.get_property() method.
author Atul Varma <varmaa@toolness.com>
date Sun, 28 Jun 2009 19:44:13 -0700
parents 532b7ddca616
children abede8af8cf5
line wrap: on
line diff
--- a/test_pymonkey.py	Sun Jun 28 19:01:43 2009 -0700
+++ b/test_pymonkey.py	Sun Jun 28 19:44:13 2009 -0700
@@ -9,6 +9,17 @@
         cx.init_standard_classes(obj)
         return cx.evaluate_script(obj, code, '<string>', 1)
 
+    def testObjectGetattrWorks(self):
+        cx = pymonkey.Runtime().new_context()
+        obj = cx.new_object()
+        cx.init_standard_classes(obj)
+        cx.evaluate_script(obj, 'boop = 5', '<string>', 1)
+        cx.evaluate_script(obj, 'this["blarg\u2026"] = 5', '<string>', 1)
+        self.assertEqual(cx.get_property(obj, "beans"),
+                         pymonkey.undefined)
+        self.assertEqual(cx.get_property(obj, u"blarg\u2026"), 5)
+        self.assertEqual(cx.get_property(obj, "boop"), 5)
+
     def testContextIsInstance(self):
         cx = pymonkey.Runtime().new_context()
         self.assertTrue(isinstance(cx, pymonkey.Context))