From b6d78fcd9c3fae5caa82b55f426aa82ed76f9429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lemburg?= Date: Fri, 7 Jul 2000 13:46:19 +0000 Subject: Tests for new instance support in unicode(). --- Lib/test/test_unicode.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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') -- cgit v0.12