Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
71082818
Commit
71082818
authored
May 15, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e63d2c94
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
wcfs/internal/xbtree_test.py
wcfs/internal/xbtree_test.py
+16
-10
No files found.
wcfs/internal/xbtree_test.py
View file @
71082818
...
...
@@ -324,26 +324,22 @@ def crack_bucket(zbucket):
def
test_restructure
():
#T = xbtree.Tree
#B = xbtree.Bucket
#1/0
# do restructure tests under ZODB because without ZODB connection it is not
# always possible to __setstate__ for e.g. .../T/B.
zstor
=
MappingStorage
()
db
=
DB
(
zstor
)
zconn
=
db
.
open
()
#zroot = zconn.root()
N
=
8
# maxkey
X
=
[]
# X[i]
=
XBlk corresponding to block #i
X
=
[]
# X[i]
->
XBlk corresponding to block #i
for
i
in
range
(
N
):
X
.
append
(
XBlk
(
'abcdefgh'
[
i
]))
# prepare ztree with given keys via usual way
# Z prepares XLOTree ztree with given keys via usual way.
# the tree is setup as {} k -> X[k].
def
Z
(
*
keys
):
ztree
=
XLOTree
()
# XXX -> class with node size=2
ztree
=
XLOTree
()
zconn
.
add
(
ztree
)
for
k
in
keys
:
ztree
[
k
]
=
X
[
k
]
...
...
@@ -354,11 +350,21 @@ def test_restructure():
# R restructures ztree to have specified new topology.
def
R
(
ztree
,
newtopo
):
items
=
list
(
ztree
.
items
())
for
(
k
,
v
)
in
items
:
assert
ztree
[
k
]
==
v
newStructure
=
xbtree
.
TopoDecode
(
newtopo
)
xbtree
.
Restructure
(
ztree
,
newStructure
)
# XXX verify iteration producess the same [] of (key, v)
# XXX verify [k] gives the same v (for all k)
assert
xbtree
.
StructureOf
(
ztree
)
==
newStructure
# verify iteration producess the same [] of (key, v)
assert
list
(
ztree
.
items
())
==
items
# verify [k] gives the same v (for all k)
for
(
k
,
v
)
in
items
:
assert
ztree
[
k
]
==
v
# Z0 creates new empty tree
def
Z0
():
...
...
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