Kaydet (Commit) faa663f0 authored tarafından Florent Xicluna's avatar Florent Xicluna

Fixed a failure in test_bigmem.

Merged revision 79059 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79059 | florent.xicluna | 2010-03-18 22:50:06 +0100 (jeu, 18 mar 2010) | 2 lines

  Issue #8024: Update the Unicode database to 5.2
........
üst 43106524
...@@ -618,7 +618,7 @@ class StrTest(unittest.TestCase, BaseStrTest): ...@@ -618,7 +618,7 @@ class StrTest(unittest.TestCase, BaseStrTest):
@precisionbigmemtest(size=_4G // 5, memuse=character_size * (6 + 1)) @precisionbigmemtest(size=_4G // 5, memuse=character_size * (6 + 1))
def test_unicode_repr_overflow(self, size): def test_unicode_repr_overflow(self, size):
try: try:
s = "\uAAAA"*size s = "\uDCBA"*size
r = repr(s) r = repr(s)
except MemoryError: except MemoryError:
pass # acceptable on 32-bit pass # acceptable on 32-bit
...@@ -679,22 +679,24 @@ class StrTest(unittest.TestCase, BaseStrTest): ...@@ -679,22 +679,24 @@ class StrTest(unittest.TestCase, BaseStrTest):
@bigmemtest(minsize=2**32 / 5, memuse=character_size * 7) @bigmemtest(minsize=2**32 / 5, memuse=character_size * 7)
def test_unicode_repr(self, size): def test_unicode_repr(self, size):
s = "\uAAAA" * size # Use an assigned, but not printable code point.
# It is in the range of the low surrogates \uDC00-\uDFFF.
s = "\uDCBA" * size
for f in (repr, ascii): for f in (repr, ascii):
r = f(s) r = f(s)
self.assertTrue(len(r) > size) self.assertTrue(len(r) > size)
self.assertTrue(r.endswith(r"\uaaaa'"), r[-10:]) self.assertTrue(r.endswith(r"\udcba'"), r[-10:])
del r del r
# The character takes 4 bytes even in UCS-2 builds because it will # The character takes 4 bytes even in UCS-2 builds because it will
# be decomposed into surrogates. # be decomposed into surrogates.
@bigmemtest(minsize=2**32 / 5, memuse=4 + character_size * 9) @bigmemtest(minsize=2**32 / 5, memuse=4 + character_size * 9)
def test_unicode_repr_wide(self, size): def test_unicode_repr_wide(self, size):
s = "\U0001AAAA" * size s = "\U0001DCBA" * size
for f in (repr, ascii): for f in (repr, ascii):
r = f(s) r = f(s)
self.assertTrue(len(r) > size) self.assertTrue(len(r) > size)
self.assertTrue(r.endswith(r"\U0001aaaa'"), r[-12:]) self.assertTrue(r.endswith(r"\U0001dcba'"), r[-12:])
del r del r
......
...@@ -21,7 +21,7 @@ errors = 'surrogatepass' ...@@ -21,7 +21,7 @@ errors = 'surrogatepass'
class UnicodeMethodsTest(unittest.TestCase): class UnicodeMethodsTest(unittest.TestCase):
# update this, if the database changes # update this, if the database changes
expectedchecksum = '0b915116051f3ed029a98542c2b7df63c9646272' expectedchecksum = '4504dffd035baea02c5b9de82bebc3d65e0e0baf'
def test_method_checksum(self): def test_method_checksum(self):
h = hashlib.sha1() h = hashlib.sha1()
...@@ -80,7 +80,7 @@ class UnicodeDatabaseTest(unittest.TestCase): ...@@ -80,7 +80,7 @@ class UnicodeDatabaseTest(unittest.TestCase):
class UnicodeFunctionsTest(UnicodeDatabaseTest): class UnicodeFunctionsTest(UnicodeDatabaseTest):
# update this, if the database changes # update this, if the database changes
expectedchecksum = 'd4169ccff998ebbd1ec007a0b3fbd66e5ccf0229' expectedchecksum = '6ccf1b1a36460d2694f9b0b0f0324942fe70ede6'
def test_function_checksum(self): def test_function_checksum(self):
data = [] data = []
......
...@@ -285,6 +285,8 @@ C-API ...@@ -285,6 +285,8 @@ C-API
Library Library
------- -------
- Issue #8024: Update the Unicode database to 5.2.
- Issue #8168: py_compile now handles files with utf-8 BOMS. - Issue #8168: py_compile now handles files with utf-8 BOMS.
- ``tokenize.detect_encoding`` now returns ``'utf-8-sig'`` when a UTF-8 BOM is - ``tokenize.detect_encoding`` now returns ``'utf-8-sig'`` when a UTF-8 BOM is
......
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -31,7 +31,7 @@ SCRIPT = sys.argv[0] ...@@ -31,7 +31,7 @@ SCRIPT = sys.argv[0]
VERSION = "2.6" VERSION = "2.6"
# The Unicode Database # The Unicode Database
UNIDATA_VERSION = "5.1.0" UNIDATA_VERSION = "5.2.0"
UNICODE_DATA = "UnicodeData%s.txt" UNICODE_DATA = "UnicodeData%s.txt"
COMPOSITION_EXCLUSIONS = "CompositionExclusions%s.txt" COMPOSITION_EXCLUSIONS = "CompositionExclusions%s.txt"
EASTASIAN_WIDTH = "EastAsianWidth%s.txt" EASTASIAN_WIDTH = "EastAsianWidth%s.txt"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment