Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a1fd0789
Commit
a1fd0789
authored
Sep 09, 2016
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to fix sizeof unit tests on dict
Issue #28056 and issue #26058.
parent
fef7e94f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
Lib/test/test_ordered_dict.py
Lib/test/test_ordered_dict.py
+2
-1
Lib/test/test_sys.py
Lib/test/test_sys.py
+3
-3
No files found.
Lib/test/test_ordered_dict.py
View file @
a1fd0789
...
...
@@ -668,7 +668,8 @@ class CPythonOrderedDictTests(OrderedDictTests, unittest.TestCase):
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'
)
...
...
Lib/test/test_sys.py
View file @
a1fd0789
...
...
@@ -937,9 +937,9 @@ class SizeofTest(unittest.TestCase):
# method-wrapper (descriptor object)
check
({}.
__iter__
,
size
(
'2P'
))
# dict
check
({},
size
(
'n
2P'
)
+
8
+
calcsize
(
'2nP2n'
)
+
8
+
(
8
*
2
//
3
)
*
calcsize
(
'n2P'
))
check
({},
size
(
'n
Q2P'
)
+
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
(
'n
2P'
)
+
8
+
calcsize
(
'2nP2n'
)
+
16
+
(
16
*
2
//
3
)
*
calcsize
(
'n2P'
))
check
(
longdict
,
size
(
'n
Q2P'
)
+
calcsize
(
'2nP2n'
)
+
16
+
(
16
*
2
//
3
)
*
calcsize
(
'n2P'
))
# dictionary-keyview
check
({}.
keys
(),
size
(
'P'
))
# dictionary-valueview
...
...
@@ -1103,7 +1103,7 @@ class SizeofTest(unittest.TestCase):
class
newstyleclass
(
object
):
pass
check
(
newstyleclass
,
s
)
# dict with shared keys
check
(
newstyleclass
().
__dict__
,
size
(
'n
2P'
+
'2nP2n'
)
+
8
)
check
(
newstyleclass
().
__dict__
,
size
(
'n
Q2P'
+
'2nP2n'
)
)
# unicode
# each tuple contains a string and its expected character size
# don't put any static strings here, as they may contain
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment