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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
5932c6ea
Commit
5932c6ea
authored
Sep 01, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit test for cypclass builtin dict update method
parent
53876859
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
90 additions
and
0 deletions
+90
-0
tests/run/cypclass_builtin_dict.pyx
tests/run/cypclass_builtin_dict.pyx
+90
-0
No files found.
tests/run/cypclass_builtin_dict.pyx
View file @
5932c6ea
...
@@ -438,3 +438,93 @@ def test_items_refcount():
...
@@ -438,3 +438,93 @@ def test_items_refcount():
if
Cy_GETREF
(
value
)
!=
2
:
if
Cy_GETREF
(
value
)
!=
2
:
return
0
return
0
return
1
return
1
def
test_update
():
"""
>>> test_update()
1
"""
d1
=
cypdict
[
Index
,
Value
]()
d2
=
cypdict
[
Index
,
Value
]()
d1
[
Index
(
1
)]
=
Value
(
10
)
d1
[
Index
(
3
)]
=
Value
(
30
)
d2
[
Index
(
4
)]
=
Value
(
40
)
d2
[
Index
(
2
)]
=
Value
(
20
)
d1
.
update
(
d2
)
if
d1
.
__len__
()
!=
4
:
return
0
for
key
in
d2
:
if
not
key
in
d1
:
return
0
if
d2
[
key
]
is
not
d1
[
key
]:
return
0
return
1
def
test_update_refcount
():
"""
>>> test_update_refcount()
1
"""
d1
=
cypdict
[
Index
,
Value
]()
d2
=
cypdict
[
Index
,
Value
]()
index1
=
Index
(
1
)
value1
=
Value
(
10
)
index2
=
Index
(
2
)
value2
=
Value
(
20
)
index3
=
Index
(
3
)
value3
=
Value
(
30
)
d1
[
index1
]
=
value1
d2
[
index2
]
=
value2
d2
[
index3
]
=
value3
if
Cy_GETREF
(
index1
)
!=
3
:
return
0
if
Cy_GETREF
(
value1
)
!=
3
:
return
0
if
Cy_GETREF
(
index2
)
!=
3
:
return
0
if
Cy_GETREF
(
value2
)
!=
3
:
return
0
if
Cy_GETREF
(
index3
)
!=
3
:
return
0
if
Cy_GETREF
(
value3
)
!=
3
:
return
0
d1
.
update
(
d2
)
if
Cy_GETREF
(
index1
)
!=
3
:
return
0
if
Cy_GETREF
(
value1
)
!=
3
:
return
0
if
Cy_GETREF
(
index2
)
!=
4
:
return
0
if
Cy_GETREF
(
value2
)
!=
4
:
return
0
if
Cy_GETREF
(
index3
)
!=
4
:
return
0
if
Cy_GETREF
(
value3
)
!=
4
:
return
0
del
d2
if
Cy_GETREF
(
index1
)
!=
3
:
return
0
if
Cy_GETREF
(
value1
)
!=
3
:
return
0
if
Cy_GETREF
(
index2
)
!=
3
:
return
0
if
Cy_GETREF
(
value2
)
!=
3
:
return
0
if
Cy_GETREF
(
index3
)
!=
3
:
return
0
if
Cy_GETREF
(
value3
)
!=
3
:
return
0
del
d1
if
Cy_GETREF
(
index1
)
!=
2
:
return
0
if
Cy_GETREF
(
value1
)
!=
2
:
return
0
if
Cy_GETREF
(
index2
)
!=
2
:
return
0
if
Cy_GETREF
(
value2
)
!=
2
:
return
0
if
Cy_GETREF
(
index3
)
!=
2
:
return
0
if
Cy_GETREF
(
value3
)
!=
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