Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_struct.py @ 83807:6707637f68ca
Issue #14596: The struct.Struct() objects now use more compact implementation.
| author | Serhiy Storchaka <storchaka@gmail.com> |
|---|---|
| date | Fri, 17 May 2013 10:49:44 +0300 |
| parents | d232cff25bbd |
| children | 0872257752c2 |
line wrap: on
line diff
--- a/Lib/test/test_struct.py Fri May 17 10:18:40 2013 +0300 +++ b/Lib/test/test_struct.py Fri May 17 10:49:44 2013 +0300 @@ -8,7 +8,6 @@ from test import support ISBIGENDIAN = sys.byteorder == "big" -IS32BIT = sys.maxsize == 0x7fffffff integer_codes = 'b', 'B', 'h', 'H', 'i', 'I', 'l', 'L', 'q', 'Q', 'n', 'N' byteorders = '', '@', '=', '<', '>', '!' @@ -538,10 +537,6 @@ hugecount2 = '{}b{}H'.format(sys.maxsize//2, sys.maxsize//2) self.assertRaises(struct.error, struct.calcsize, hugecount2) - if IS32BIT: - def test_crasher(self): - self.assertRaises(MemoryError, struct.pack, "357913941b", "a") - def test_trailing_counter(self): store = array.array('b', b' '*100) @@ -578,7 +573,7 @@ # The size of 'PyStructObject' totalsize = support.calcobjsize('2n3P') # The size taken up by the 'formatcode' dynamic array - totalsize += struct.calcsize('P2n0P') * (number_of_codes + 1) + totalsize += struct.calcsize('P3n0P') * (number_of_codes + 1) support.check_sizeof(self, struct.Struct(format_str), totalsize) @support.cpython_only @@ -589,7 +584,7 @@ self.check_sizeof('B' * 1234, 1234) self.check_sizeof('fd', 2) self.check_sizeof('xxxxxxxxxxxxxx', 0) - self.check_sizeof('100H', 100) + self.check_sizeof('100H', 1) self.check_sizeof('187s', 1) self.check_sizeof('20p', 1) self.check_sizeof('0s', 1)
