diff options
author | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2005-08-12 17:34:58 (GMT) |
---|---|---|
committer | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2005-08-12 17:34:58 (GMT) |
commit | cf52c0784364c09818ffd3fcaabffec667dba01d (patch) | |
tree | 6376fa09a2c4ba2ff6db8a3a3d6445d55fba5824 /Lib/test | |
parent | ba7d95e21588c649a262e30103a33a237cc142a0 (diff) | |
download | cpython-cf52c0784364c09818ffd3fcaabffec667dba01d.zip cpython-cf52c0784364c09818ffd3fcaabffec667dba01d.tar.gz cpython-cf52c0784364c09818ffd3fcaabffec667dba01d.tar.bz2 |
Change the %s format specifier for str objects so that it returns a
unicode instance if the argument is not an instance of basestring and
calling __str__ on the argument returns a unicode instance.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_unicode.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 80242d5..d85f171 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -388,6 +388,10 @@ class UnicodeTest( self.assertEqual('%i %*.*s' % (10, 5,3,u'abc',), u'10 abc') self.assertEqual('%i%s %*.*s' % (10, 3, 5, 3, u'abc',), u'103 abc') self.assertEqual('%c' % u'a', u'a') + class Wrapper: + def __str__(self): + return u'\u1234' + self.assertEqual('%s' % Wrapper(), u'\u1234') def test_constructor(self): # unicode(obj) tests (this maps to PyObject_Unicode() at C level) |