Commit d799fe96 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent d6badf0f
......@@ -136,7 +136,7 @@ class Tree(object):
# TODO def graphviz() -> str for graphviz
# Bucked represents a bucket node.
# Bucket represents a bucket node.
class Bucket(object):
# .keyv () of keys
def __init__(b, *keyv): # XXX *keyv -> keyv ?
......@@ -234,7 +234,7 @@ class TopoDecodeError(Exception):
def TopoDecode(text):
levelv = text.split('/') # T3/T-T/B1-T5/B-B7,8,9 -> T3 T-T B1-T5 B-B7,8,9
# build nodes from bottop-up
# build nodes from bottom-up
currentv = [] # of nodes on current level (that we are building)
bottomq = [] # of nodes below current level that we are building
# shrinks as fifo as nodes added to currentv link to bottom
......
......@@ -43,18 +43,14 @@ def test_structureOf():
# https://github.com/zopefoundation/BTrees/blob/4.7.2-1-g078ba60/BTrees/tests/testBTrees.py#L20
t, keys = testBTrees.DegenerateBTree("testBasicOps")._build_degenerate_tree()
assert keys == [1, 3, 5, 7, 11]
_ = xbtree.StructureOf(t)
assert _ == T([4],
T([2],
T([], B(1)), T([], B(3))),
T([],
T([6, 10],
T([], T([], B(5))),
T([], B(7)),
T([], B(11))) ))
assert xbtree.TopoEncode(_) == 'T4/T2-T/T-T-T6,10/B1-B3-T-T-T/T-B7-B11/B5'
assert xbtree.StructureOf(t) == T([4],
T([2],
T([], B(1)), T([], B(3))),
T([],
T([6, 10],
T([], T([], B(5))),
T([], B(7)),
T([], B(11))) ))
def test_topoEncoding():
......@@ -79,7 +75,15 @@ def test_topoEncoding():
T([],
T([5], B(), B(7,8,9))))) == "T3/T-T/B1-T5/B-B7,8,9"
# XXX degenerate btree from ^^^
# degenerate btree from ^^^
assert X(T([4],
T([2],
T([], B(1)), T([], B(3))),
T([],
T([6, 10],
T([], T([], B(5))),
T([], B(7)),
T([], B(11))) ))) == "T4/T2-T/T-T-T6,10/B1-B3-T-T-T/T-B7-B11/B5"
def test_allStructs():
......
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