diff test_pymonkey.py @ 27:21045074139f

Based on my new understanding of JSString */jschar * thanks to folks on #jsapi, I've removed the requirement that SpiderMonkey be in UTF-8 mode to translate strings between Python and SpiderMonkey.
author Atul Varma <varmaa@toolness.com>
date Mon, 29 Jun 2009 13:33:07 -0700
parents 74b7ad049542
children bd30f5c02fc3
line wrap: on
line diff
--- a/test_pymonkey.py	Mon Jun 29 10:35:06 2009 -0700
+++ b/test_pymonkey.py	Mon Jun 29 13:33:07 2009 -0700
@@ -28,10 +28,10 @@
         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"),
+        self.assertTrue(isinstance(cx.get_property(obj, u"foo"),
                                    pymonkey.Object))
-        self.assertTrue(cx.get_property(obj, "foo") is
-                        cx.get_property(obj, "foo"))
+        self.assertTrue(cx.get_property(obj, u"foo") is
+                        cx.get_property(obj, u"foo"))
 
     def testObjectGetattrWorks(self):
         cx = pymonkey.Runtime().new_context()
@@ -39,10 +39,10 @@
         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"),
+        self.assertEqual(cx.get_property(obj, u"beans"),
                          pymonkey.undefined)
         self.assertEqual(cx.get_property(obj, u"blarg\u2026"), 5)
-        self.assertEqual(cx.get_property(obj, "boop"), 5)
+        self.assertEqual(cx.get_property(obj, u"boop"), 5)
 
     def testContextIsInstance(self):
         cx = pymonkey.Runtime().new_context()
@@ -82,7 +82,7 @@
         cx.init_standard_classes(obj)
         obj = cx.evaluate_script(obj, '({boop: 1})', '<string>', 1)
         self.assertTrue(isinstance(obj, pymonkey.Object))
-        self.assertEqual(cx.get_property(obj, "boop"), 1)
+        self.assertEqual(cx.get_property(obj, u"boop"), 1)
 
     def testEvaluateReturnsTrue(self):
         self.assertTrue(self._evaljs('true') is True)