diff options
author | Finn Bock <bckfnn@worldonline.dk> | 2001-12-10 20:57:34 (GMT) |
---|---|---|
committer | Finn Bock <bckfnn@worldonline.dk> | 2001-12-10 20:57:34 (GMT) |
commit | 2b29cb2593c2ca96eb4a0b32b1a6167ce5f18b7c (patch) | |
tree | 66665ca2e4692789c424364ab2c5999f67ae5e41 /Lib | |
parent | cf72abab8c45f9490525b245fe49d2ff76a58ad9 (diff) | |
download | cpython-2b29cb2593c2ca96eb4a0b32b1a6167ce5f18b7c.zip cpython-2b29cb2593c2ca96eb4a0b32b1a6167ce5f18b7c.tar.gz cpython-2b29cb2593c2ca96eb4a0b32b1a6167ce5f18b7c.tar.bz2 |
Skipping some tests by adding the usual jython conditional test around:
- the repr of unicode. Jython only add the u'' if the string contains char
values > 255.
- A unicode arg to unicode() is perfectly valid in jython.
- A test buffer() test. No buffer() on Jython
This closes patch "[ #490920 ] Jython and test_unicode".
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_unicode.py | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 77d978b..8d4bed5 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -8,21 +8,22 @@ Written by Marc-Andre Lemburg (mal@lemburg.com). from test_support import verify, verbose, TestFailed import sys -# Test basic sanity of repr() -verify(repr(u'abc') == "u'abc'") -verify(repr(u'ab\\c') == "u'ab\\\\c'") -verify(repr(u'ab\\') == "u'ab\\\\'") -verify(repr(u'\\c') == "u'\\\\c'") -verify(repr(u'\\') == "u'\\\\'") -verify(repr(u'\n') == "u'\\n'") -verify(repr(u'\r') == "u'\\r'") -verify(repr(u'\t') == "u'\\t'") -verify(repr(u'\b') == "u'\\x08'") -verify(repr(u"'\"") == """u'\\'"'""") -verify(repr(u"'\"") == """u'\\'"'""") -verify(repr(u"'") == '''u"'"''') -verify(repr(u'"') == """u'"'""") -verify(repr(u''.join(map(unichr, range(256)))) == +if not sys.platform.startswith('java'): + # Test basic sanity of repr() + verify(repr(u'abc') == "u'abc'") + verify(repr(u'ab\\c') == "u'ab\\\\c'") + verify(repr(u'ab\\') == "u'ab\\\\'") + verify(repr(u'\\c') == "u'\\\\c'") + verify(repr(u'\\') == "u'\\\\'") + verify(repr(u'\n') == "u'\\n'") + verify(repr(u'\r') == "u'\\r'") + verify(repr(u'\t') == "u'\\t'") + verify(repr(u'\b') == "u'\\x08'") + verify(repr(u"'\"") == """u'\\'"'""") + verify(repr(u"'\"") == """u'\\'"'""") + verify(repr(u"'") == '''u"'"''') + verify(repr(u'"') == """u'"'""") + verify(repr(u''.join(map(unichr, range(256)))) == "u'\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\t\\n\\x0b\\x0c\\r" "\\x0e\\x0f\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a" "\\x1b\\x1c\\x1d\\x1e\\x1f !\"#$%&\\'()*+,-./0123456789:;<=>?@ABCDEFGHI" @@ -446,19 +447,21 @@ for obj in (123, 123.45, 123L): # unicode(obj, encoding, error) tests (this maps to # PyUnicode_FromEncodedObject() at C level) -try: - unicode(u'decoding unicode is not supported', 'utf-8', 'strict') -except TypeError: - pass -else: - raise TestFailed, "decoding unicode should NOT be supported" +if not sys.platform.startswith('java'): + try: + unicode(u'decoding unicode is not supported', 'utf-8', 'strict') + except TypeError: + pass + else: + raise TestFailed, "decoding unicode should NOT be supported" verify(unicode('strings are decoded to unicode', 'utf-8', 'strict') == u'strings are decoded to unicode') -verify(unicode(buffer('character buffers are decoded to unicode'), - 'utf-8', 'strict') - == u'character buffers are decoded to unicode') +if not sys.platform.startswith('java'): + verify(unicode(buffer('character buffers are decoded to unicode'), + 'utf-8', 'strict') + == u'character buffers are decoded to unicode') print 'done.' |