Mercurial > pymonkey
diff test_pymonkey.py @ 95:0701aee1b0cd
JS-wrapped python functions can now return normal strings (not just unicode).
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Sat, 15 Aug 2009 00:50:55 -0700 |
parents | c66d7da09c95 |
children | e4f7cc6beafe |
line wrap: on
line diff
--- a/test_pymonkey.py Sat Aug 15 00:25:48 2009 -0700 +++ b/test_pymonkey.py Sat Aug 15 00:50:55 2009 -0700 @@ -245,11 +245,17 @@ 'hai2u("blah\x00 ")'), u"blah\x00 o hai") + def testJsWrappedPythonFunctionReturnsString(self): + def hai2u(cx, this, args): + return "o hai" + self.assertEqual(self._evalJsWrappedPyFunc(hai2u, 'hai2u()'), + "o hai") + def testJsWrappedPythonFunctionReturnsUnicode(self): def hai2u(cx, this, args): - return u"o hai" + return u"o hai\u2026" self.assertEqual(self._evalJsWrappedPyFunc(hai2u, 'hai2u()'), - u"o hai") + u"o hai\u2026") def testJsWrappedPythonFunctionThrowsJsException(self): def hai2u(cx, this, args):