Commit 986ff81d authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent d278bef2
......@@ -18,10 +18,13 @@
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.
"""Package xbtree provides utilities for inspecting/manipulating internal structure of BTrees.
"""Package xbtree provides utilities for inspecting/manipulating internal
structure of integer-keyed BTrees.
It is primarily used to verify ΔBTail in wcfs.
- `Tree` represents a tree node.
- `Bucket` represents a bucket node.
XXX Typology:
"""
......@@ -97,7 +100,7 @@ def StructureOf(node):
if is_tree:
kind, keys, children = bcheck.crack_btree(node, is_map)
if kind == bcheck.BTREE_EMPTY:
return Tree([])
return Tree([], Bucket())
if kind == bcheck.BTREE_ONE:
b = node._bucket_type()
......
......@@ -19,15 +19,21 @@
# See https://www.nexedi.com/licensing for rationale and options.
from wendelin.wcfs.internal import xbtree
from BTrees.LOBTree import LOBTree
from BTrees.tests import testBTrees
def test_topologyOf():
T = xbtree.Tree
B = xbtree.Bucket
# XXX empty
# empty tree
t = LOBTree()
assert xbtree.StructureOf(t) == T([], B())
# XXX 1 k->v
# tree with 1 k->v
t = LOBTree()
t[10] = 'hello'
assert xbtree.StructureOf(t) == T([], B(10))
# known degenerate topology, see:
# https://github.com/zopefoundation/ZODB/commit/6cd24e99f89b
......@@ -44,7 +50,7 @@ def test_topologyOf():
T([], B(7)),
T([], B(11))) ))
assert btree.TopoEncodingOf(t) == ((4,), (2,), ø(4), (6,10), ø(5?), ø(7), ø(11), x(5?))
#assert btree.TopoEncodingOf(t) == ((4,), (2,), ø(4), (6,10), ø(5?), ø(7), ø(11), x(5?))
"""
assert xbtree.TopologyOf(t) == ( (4,),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment