Skip to content

Commit

Permalink
Add tests demonstrating lack of __unicode__ proxying
Browse files Browse the repository at this point in the history
  • Loading branch information
mgedmin committed Dec 19, 2013
1 parent aa7c518 commit 03efa84
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/zope/proxy/tests/test_proxy.py
Expand Up @@ -108,6 +108,26 @@ def _foo():
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
Expand Down

0 comments on commit 03efa84

Please sign in to comment.