Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xavier Thompson
cython
Commits
08bda787
Commit
08bda787
authored
Sep 01, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit tests for cypclass dict views and iterators increasing dict refcount
parent
dd2ff59b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
127 additions
and
0 deletions
+127
-0
tests/run/cypclass_builtin_dict.pyx
tests/run/cypclass_builtin_dict.pyx
+127
-0
No files found.
tests/run/cypclass_builtin_dict.pyx
View file @
08bda787
...
...
@@ -559,3 +559,130 @@ def test_update_refcount():
if
Cy_GETREF
(
value3
)
!=
2
:
return
0
return
1
def
test_view_dict_refcount
():
"""
>>> test_view_dict_refcount()
1
"""
d
=
cypdict
[
Index
,
Value
]()
if
Cy_GETREF
(
d
)
!=
2
:
return
0
def
keys_view
():
key_view
=
d
.
keys
()
if
Cy_GETREF
(
d
)
!=
3
:
return
0
return
1
if
not
keys_view
():
return
0
if
Cy_GETREF
(
d
)
!=
2
:
return
0
def
values_view
():
values_view
=
d
.
values
()
if
Cy_GETREF
(
d
)
!=
3
:
return
0
return
1
if
not
values_view
():
return
0
if
Cy_GETREF
(
d
)
!=
2
:
return
0
def
items_view
():
items_view
=
d
.
items
()
if
Cy_GETREF
(
d
)
!=
3
:
return
0
return
1
if
not
items_view
():
return
0
if
Cy_GETREF
(
d
)
!=
2
:
return
0
return
1
def
test_iterator_refcount
():
"""
>>> test_iterator_refcount()
1
"""
d
=
cypdict
[
Index
,
Value
]()
if
Cy_GETREF
(
d
)
!=
2
:
return
0
def
begin_iterator
():
it
=
d
.
begin
()
if
Cy_GETREF
(
d
)
!=
3
:
return
0
return
1
if
not
begin_iterator
():
return
0
if
Cy_GETREF
(
d
)
!=
2
:
return
0
def
end_iterator
():
it
=
d
.
end
()
if
Cy_GETREF
(
d
)
!=
2
:
return
0
return
1
if
not
end_iterator
():
return
0
if
Cy_GETREF
(
d
)
!=
2
:
return
0
def
keys_begin_iterator
():
keys
=
d
.
keys
()
if
Cy_GETREF
(
d
)
!=
3
:
return
0
it
=
keys
.
begin
()
if
Cy_GETREF
(
d
)
!=
4
:
return
0
return
1
if
not
keys_begin_iterator
():
return
0
if
Cy_GETREF
(
d
)
!=
2
:
return
0
def
values_begin_iterator
():
values
=
d
.
values
()
if
Cy_GETREF
(
d
)
!=
3
:
return
0
it
=
values
.
begin
()
if
Cy_GETREF
(
d
)
!=
4
:
return
0
return
1
if
not
values_begin_iterator
():
return
0
if
Cy_GETREF
(
d
)
!=
2
:
return
0
def
items_begin_iterator
():
items
=
d
.
items
()
if
Cy_GETREF
(
d
)
!=
3
:
return
0
it
=
items
.
begin
()
if
Cy_GETREF
(
d
)
!=
4
:
return
0
return
1
if
not
items_begin_iterator
():
return
0
if
Cy_GETREF
(
d
)
!=
2
:
return
0
return
1
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