diff test_pymonkey.py @ 73:efa0cfe6fc03

Resolved two TODOs.
author Atul Varma <varmaa@toolness.com>
date Mon, 27 Jul 2009 22:00:03 -0700
parents 9b3f4e53e365
children e06376295170
line wrap: on
line diff
--- a/test_pymonkey.py	Mon Jul 27 21:53:43 2009 -0700
+++ b/test_pymonkey.py	Mon Jul 27 22:00:03 2009 -0700
@@ -254,6 +254,18 @@
         self.assertTrue(cx.get_property(obj, u"foo") is
                         cx.get_property(obj, u"foo"))
 
+    def testObjectGetattrThrowsException(self):
+        cx = pymonkey.Runtime().new_context()
+        obj = cx.new_object()
+        cx.init_standard_classes(obj)
+        result = cx.evaluate_script(obj, '({get foo() { throw "blah"; }})',
+                                    '<string>', 1)
+        self.assertRaises(pymonkey.error,
+                          cx.get_property,
+                          result,
+                          u"foo")
+        self.assertEqual(self.last_exception.message, u"blah")
+
     def testObjectGetattrWorks(self):
         cx = pymonkey.Runtime().new_context()
         obj = cx.new_object()