mirror of
https://github.com/python/cpython.git
synced 2025-09-01 14:38:00 +00:00
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".
This commit is contained in:
parent
cf72abab8c
commit
2b29cb2593
1 changed files with 27 additions and 24 deletions
|
@ -8,6 +8,7 @@ Written by Marc-Andre Lemburg (mal@lemburg.com).
|
||||||
from test_support import verify, verbose, TestFailed
|
from test_support import verify, verbose, TestFailed
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
if not sys.platform.startswith('java'):
|
||||||
# Test basic sanity of repr()
|
# Test basic sanity of repr()
|
||||||
verify(repr(u'abc') == "u'abc'")
|
verify(repr(u'abc') == "u'abc'")
|
||||||
verify(repr(u'ab\\c') == "u'ab\\\\c'")
|
verify(repr(u'ab\\c') == "u'ab\\\\c'")
|
||||||
|
@ -446,6 +447,7 @@ for obj in (123, 123.45, 123L):
|
||||||
# unicode(obj, encoding, error) tests (this maps to
|
# unicode(obj, encoding, error) tests (this maps to
|
||||||
# PyUnicode_FromEncodedObject() at C level)
|
# PyUnicode_FromEncodedObject() at C level)
|
||||||
|
|
||||||
|
if not sys.platform.startswith('java'):
|
||||||
try:
|
try:
|
||||||
unicode(u'decoding unicode is not supported', 'utf-8', 'strict')
|
unicode(u'decoding unicode is not supported', 'utf-8', 'strict')
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
@ -456,6 +458,7 @@ else:
|
||||||
verify(unicode('strings are decoded to unicode', 'utf-8', 'strict')
|
verify(unicode('strings are decoded to unicode', 'utf-8', 'strict')
|
||||||
== u'strings are decoded to unicode')
|
== u'strings are decoded to unicode')
|
||||||
|
|
||||||
|
if not sys.platform.startswith('java'):
|
||||||
verify(unicode(buffer('character buffers are decoded to unicode'),
|
verify(unicode(buffer('character buffers are decoded to unicode'),
|
||||||
'utf-8', 'strict')
|
'utf-8', 'strict')
|
||||||
== u'character buffers are decoded to unicode')
|
== u'character buffers are decoded to unicode')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue