Commit 03efa840 authored by Marius Gedminas's avatar Marius Gedminas

Add tests demonstrating lack of __unicode__ proxying

parent aa7c5184
......@@ -108,6 +108,26 @@ class PyProxyBaseTestCase(unittest.TestCase):
proxy = self._makeOne(_foo)
self.assertTrue(unicode(proxy).startswith('<function _foo'))
def test___unicode__of_unicode(self):
from zope.proxy._compat import PY3
if PY3: # Gone in Python 3:
return
s = u'Hello, \u2603'
proxy = self._makeOne(s)
self.assertEqual(unicode(proxy), s)
def test___unicode__of_custom_class(self):
from zope.proxy._compat import PY3
if PY3: # Gone in Python 3:
return
class CustomClass(object):
def __unicode__(self):
return u'Hello, \u2603'
cc = CustomClass()
self.assertEqual(unicode(cc), u'Hello, \u2603')
proxy = self._makeOne(cc)
self.assertEqual(unicode(proxy), u'Hello, \u2603')
def test___reduce___via_pickling(self):
import pickle
from zope.proxy._compat import PY3
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment