diff options
author | Marc-André Lemburg <mal@egenix.com> | 2000-08-08 08:04:29 (GMT) |
---|---|---|
committer | Marc-André Lemburg <mal@egenix.com> | 2000-08-08 08:04:29 (GMT) |
commit | e5034378cc2e46f9a7233269a5687bfec8c8c303 (patch) | |
tree | e7b66c147c9ded2b44114d0fb35968febc9febd4 /Lib | |
parent | 5660639f9f1121cdb7abf6202a6005f1a890a1e5 (diff) | |
download | cpython-e5034378cc2e46f9a7233269a5687bfec8c8c303.zip cpython-e5034378cc2e46f9a7233269a5687bfec8c8c303.tar.gz cpython-e5034378cc2e46f9a7233269a5687bfec8c8c303.tar.bz2 |
Removing UTF-16 aware Unicode comparison code. This kind of compare
function (together with other locale aware ones) should into a new collation
support module. See python-dev for a discussion of this removal.
Note: This patch should also be applied to the 1.6 branch.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/output/test_unicode | 1 | ||||
-rw-r--r-- | Lib/test/test_unicode.py | 103 |
2 files changed, 53 insertions, 51 deletions
diff --git a/Lib/test/output/test_unicode b/Lib/test/output/test_unicode index 87379cd..783a486 100644 --- a/Lib/test/output/test_unicode +++ b/Lib/test/output/test_unicode @@ -1,6 +1,5 @@ test_unicode Testing Unicode comparisons... done. -Testing UTF-16 code point order comparisons... done. Testing Unicode contains method... done. Testing Unicode formatting strings... done. Testing builtin codecs... done. diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 76a2591..8479c20 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -168,56 +168,59 @@ assert 'abc' < u'abcd' assert u'abc' < u'abcd' print 'done.' -print 'Testing UTF-16 code point order comparisons...', -#No surrogates, no fixup required. -assert u'\u0061' < u'\u20ac' -# Non surrogate below surrogate value, no fixup required -assert u'\u0061' < u'\ud800\udc02' - -# Non surrogate above surrogate value, fixup required -def test_lecmp(s, s2): - assert s < s2 , "comparison failed on %s < %s" % (s, s2) - -def test_fixup(s): - s2 = u'\ud800\udc01' - test_lecmp(s, s2) - s2 = u'\ud900\udc01' - test_lecmp(s, s2) - s2 = u'\uda00\udc01' - test_lecmp(s, s2) - s2 = u'\udb00\udc01' - test_lecmp(s, s2) - s2 = u'\ud800\udd01' - test_lecmp(s, s2) - s2 = u'\ud900\udd01' - test_lecmp(s, s2) - s2 = u'\uda00\udd01' - test_lecmp(s, s2) - s2 = u'\udb00\udd01' - test_lecmp(s, s2) - s2 = u'\ud800\ude01' - test_lecmp(s, s2) - s2 = u'\ud900\ude01' - test_lecmp(s, s2) - s2 = u'\uda00\ude01' - test_lecmp(s, s2) - s2 = u'\udb00\ude01' - test_lecmp(s, s2) - s2 = u'\ud800\udfff' - test_lecmp(s, s2) - s2 = u'\ud900\udfff' - test_lecmp(s, s2) - s2 = u'\uda00\udfff' - test_lecmp(s, s2) - s2 = u'\udb00\udfff' - test_lecmp(s, s2) - -test_fixup(u'\ue000') -test_fixup(u'\uff61') - -# Surrogates on both sides, no fixup required -assert u'\ud800\udc02' < u'\ud84d\udc56' -print 'done.' +if 0: + # Move these tests to a Unicode collation module test... + + print 'Testing UTF-16 code point order comparisons...', + #No surrogates, no fixup required. + assert u'\u0061' < u'\u20ac' + # Non surrogate below surrogate value, no fixup required + assert u'\u0061' < u'\ud800\udc02' + + # Non surrogate above surrogate value, fixup required + def test_lecmp(s, s2): + assert s < s2 , "comparison failed on %s < %s" % (s, s2) + + def test_fixup(s): + s2 = u'\ud800\udc01' + test_lecmp(s, s2) + s2 = u'\ud900\udc01' + test_lecmp(s, s2) + s2 = u'\uda00\udc01' + test_lecmp(s, s2) + s2 = u'\udb00\udc01' + test_lecmp(s, s2) + s2 = u'\ud800\udd01' + test_lecmp(s, s2) + s2 = u'\ud900\udd01' + test_lecmp(s, s2) + s2 = u'\uda00\udd01' + test_lecmp(s, s2) + s2 = u'\udb00\udd01' + test_lecmp(s, s2) + s2 = u'\ud800\ude01' + test_lecmp(s, s2) + s2 = u'\ud900\ude01' + test_lecmp(s, s2) + s2 = u'\uda00\ude01' + test_lecmp(s, s2) + s2 = u'\udb00\ude01' + test_lecmp(s, s2) + s2 = u'\ud800\udfff' + test_lecmp(s, s2) + s2 = u'\ud900\udfff' + test_lecmp(s, s2) + s2 = u'\uda00\udfff' + test_lecmp(s, s2) + s2 = u'\udb00\udfff' + test_lecmp(s, s2) + + test_fixup(u'\ue000') + test_fixup(u'\uff61') + + # Surrogates on both sides, no fixup required + assert u'\ud800\udc02' < u'\ud84d\udc56' + print 'done.' test('ljust', u'abc', u'abc ', 10) test('rjust', u'abc', u' abc', 10) |