diff Lib/test/test_weakref.py @ 57348:42aaedaefbcb 3.1

Merged revisions 76396 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r76396 | benjamin.peterson | 2009-11-18 21:08:32 -0600 (Wed, 18 Nov 2009) | 10 lines fix __bytes__ handling here in py3x Merged revisions 76395 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r76395 | benjamin.peterson | 2009-11-18 21:00:02 -0600 (Wed, 18 Nov 2009) | 1 line #5037 proxy __unicode__ correctly ........ ................
author Benjamin Peterson <benjamin@python.org>
date Thu, 19 Nov 2009 03:10:36 +0000
parents 0bb232078b8c
children 84caac71d79b
line wrap: on
line diff
--- a/Lib/test/test_weakref.py	Thu Nov 19 01:23:41 2009 +0000
+++ b/Lib/test/test_weakref.py	Thu Nov 19 03:10:36 2009 +0000
@@ -183,6 +183,17 @@
         self.assertEqual(L3[:5], p3[:5])
         self.assertEqual(L3[2:5], p3[2:5])
 
+    def test_proxy_unicode(self):
+        # See bug 5037
+        class C(object):
+            def __str__(self):
+                return "string"
+            def __bytes__(self):
+                return b"bytes"
+        instance = C()
+        self.assertTrue("__bytes__" in dir(weakref.proxy(instance)))
+        self.assertEqual(bytes(weakref.proxy(instance)), b"bytes")
+
     def test_proxy_index(self):
         class C:
             def __index__(self):