[Python-checkins] cpython: Try to fix sizeof unit tests on dict
victor.stinner
python-checkins at python.org
Sat Sep 10 00:52:33 EDT 2016
https://hg.python.org/cpython/rev/c3776dd858f0
changeset: 103551:c3776dd858f0
user: Victor Stinner <victor.stinner at gmail.com>
date: Fri Sep 09 21:51:19 2016 -0700
summary:
Try to fix sizeof unit tests on dict
Issue #28056 and issue #26058.
files:
Lib/test/test_ordered_dict.py | 3 ++-
Lib/test/test_sys.py | 6 +++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/Lib/test/test_ordered_dict.py b/Lib/test/test_ordered_dict.py
--- a/Lib/test/test_ordered_dict.py
+++ b/Lib/test/test_ordered_dict.py
@@ -668,7 +668,8 @@
size = support.calcobjsize
check = self.check_sizeof
- basicsize = size('n2P3PnPn2P') + 8 + calcsize('2nP2n')
+ basicsize = size('nQ2P' + '3PnPn2P') + calcsize('2nP2n')
+
entrysize = calcsize('n2P')
p = calcsize('P')
nodesize = calcsize('Pn2P')
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -937,9 +937,9 @@
# method-wrapper (descriptor object)
check({}.__iter__, size('2P'))
# dict
- check({}, size('n2P') + 8 + calcsize('2nP2n') + 8 + (8*2//3)*calcsize('n2P'))
+ check({}, size('nQ2P') + calcsize('2nP2n') + 8 + (8*2//3)*calcsize('n2P'))
longdict = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8}
- check(longdict, size('n2P') + 8 + calcsize('2nP2n') + 16 + (16*2//3)*calcsize('n2P'))
+ check(longdict, size('nQ2P') + calcsize('2nP2n') + 16 + (16*2//3)*calcsize('n2P'))
# dictionary-keyview
check({}.keys(), size('P'))
# dictionary-valueview
@@ -1103,7 +1103,7 @@
class newstyleclass(object): pass
check(newstyleclass, s)
# dict with shared keys
- check(newstyleclass().__dict__, size('n2P' + '2nP2n') + 8)
+ check(newstyleclass().__dict__, size('nQ2P' + '2nP2n'))
# unicode
# each tuple contains a string and its expected character size
# don't put any static strings here, as they may contain
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list