Mercurial > pymonkey
changeset 59:fb97bed55789
Added a test that fails b/c of a known bug in pymonkey.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Sun, 19 Jul 2009 20:27:25 -0700 |
parents | 7a3461ccaf1d |
children | e557d84318a7 |
files | test_pymonkey.py |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/test_pymonkey.py Sun Jul 19 19:58:15 2009 -0700 +++ b/test_pymonkey.py Sun Jul 19 20:27:25 2009 -0700 @@ -1,5 +1,6 @@ import sys import unittest +import weakref import pymonkey @@ -32,6 +33,22 @@ self.assertEqual(str(pymonkey.undefined), "pymonkey.undefined") + def testJsWrappedPythonFuncIsNotGCd(self): + # TODO: Make this test pass. + def define(cx, obj): + def func(cx, this, args): + return u'func was called' + jsfunc = cx.new_function(func, func.__name__) + cx.define_property(obj, func.__name__, jsfunc) + return weakref.ref(func) + cx = pymonkey.Runtime().new_context() + obj = cx.new_object() + cx.init_standard_classes(obj) + ref = define(cx, obj) + self.assertNotEqual(ref(), None) + result = cx.evaluate_script(obj, 'func()', '<string>', 1) + self.assertEqual(result, u'func was called') + def testJsWrappedPythonFuncPassesContext(self): contexts = []