summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2000-07-07 13:46:19 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2000-07-07 13:46:19 (GMT)
commitb6d78fcd9c3fae5caa82b55f426aa82ed76f9429 (patch)
tree79131b17c5b72bd4e4d800b0089879e58a3884f2 /Lib/test
parent3d476d73a944bcc1c1395565d42df1f1d551d6d8 (diff)
downloadcpython-b6d78fcd9c3fae5caa82b55f426aa82ed76f9429.zip
cpython-b6d78fcd9c3fae5caa82b55f426aa82ed76f9429.tar.gz
cpython-b6d78fcd9c3fae5caa82b55f426aa82ed76f9429.tar.bz2
Tests for new instance support in unicode().
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_unicode.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index ec894ed..ef8bd82 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -298,6 +298,21 @@ assert unicode('hello','utf-8') == u'hello'
assert unicode('hello','utf8') == u'hello'
assert unicode('hello','latin-1') == u'hello'
+class String:
+ x = ''
+ def __str__(self):
+ return self.x
+
+o = String()
+
+o.x = 'abc'
+assert unicode(o) == u'abc'
+assert str(o) == 'abc'
+
+o.x = u'abc'
+assert unicode(o) == u'abc'
+assert str(o) == 'abc'
+
try:
u'Andr\202 x'.encode('ascii')
u'Andr\202 x'.encode('ascii','strict')