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
bf275b13
Commit
bf275b13
authored
May 18, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6787cb82
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
3 deletions
+21
-3
wcfs/internal/xbtree_test.py
wcfs/internal/xbtree_test.py
+21
-3
No files found.
wcfs/internal/xbtree_test.py
View file @
bf275b13
...
@@ -392,7 +392,7 @@ def crack_bucket(zbucket):
...
@@ -392,7 +392,7 @@ def crack_bucket(zbucket):
assert
xbtree
.
_zclassify
(
zbucket
).
is_zbucket
,
zbucket
assert
xbtree
.
_zclassify
(
zbucket
).
is_zbucket
,
zbucket
return
zbcheck
.
crack_bucket
(
zbucket
,
is_mapping
=
True
)
return
zbcheck
.
crack_bucket
(
zbucket
,
is_mapping
=
True
)
# assertT asserts that znode is normal tree node
of type typ
+ has specified keys and children.
# assertT asserts that znode is normal tree node + has specified keys and children.
#
#
# by default children are checked exactly via "is"
# by default children are checked exactly via "is"
# if a child is represented as 'T' or 'B' - it is only verified to be of tree
# if a child is represented as 'T' or 'B' - it is only verified to be of tree
...
@@ -416,6 +416,22 @@ def assertT(znode, keyv, *children): # -> [] of children marked with 'T'/'B'
...
@@ -416,6 +416,22 @@ def assertT(znode, keyv, *children): # -> [] of children marked with 'T'/'B'
assert
child
is
childOK
assert
child
is
childOK
return
retv
return
retv
# assertB asserts that znode is bucket node with specified keys and values
def
assertB
(
znode
,
*
kvv
):
_
=
xbtree
.
_zclassify
(
znode
)
assert
_
.
is_zbucket
keys
,
values
=
zbcheck
.
crack_bucket
(
znode
,
_
.
is_map
)
if
not
_
.
is_map
:
assert
values
is
None
assert
keys
==
kvv
else
:
assert
len
(
keys
)
==
len
(
values
)
assert
len
(
keys
)
==
len
(
kvv
)
for
(
i
,(
k
,
v
))
in
enumerate
(
zip
(
keys
,
values
)):
kok
,
vok
=
kvv
[
i
]
assert
k
==
kok
assert
v
is
vok
def
test_restructure
():
def
test_restructure
():
# do restructure tests under ZODB because without ZODB connection it is not
# do restructure tests under ZODB because without ZODB connection it is not
# always possible to __setstate__ for e.g. .../T/B.
# always possible to __setstate__ for e.g. .../T/B.
...
@@ -429,6 +445,9 @@ def test_restructure():
...
@@ -429,6 +445,9 @@ def test_restructure():
for
i
in
range
(
N
):
for
i
in
range
(
N
):
X
.
append
(
XBlk
(
'abcdefgh'
[
i
]))
X
.
append
(
XBlk
(
'abcdefgh'
[
i
]))
def
assertB
(
znode
,
*
keyv
):
globals
()[
'assertB'
](
znode
,
*
[(
k
,
X
[
k
])
for
k
in
keyv
])
# Z prepares XLOTree 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].
# the tree is setup as {} k -> X[k].
def
Z
(
*
keys
):
def
Z
(
*
keys
):
...
@@ -773,8 +792,7 @@ def test_zwalkBFS():
...
@@ -773,8 +792,7 @@ def test_zwalkBFS():
# assertB asserts that znode is bucket + has specified keys
# assertB asserts that znode is bucket + has specified keys
def
assertB
(
znode
,
*
keyv
):
def
assertB
(
znode
,
*
keyv
):
assert
isinstance
(
znode
,
IISet
)
assert
isinstance
(
znode
,
IISet
)
keys
,
_
=
zbcheck
.
crack_bucket
(
znode
,
False
)
globals
()[
'assertB'
](
znode
,
*
keyv
)
assert
keys
==
keyv
R
=
xbtree
.
_Range
R
=
xbtree
.
_Range
...
...
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