Commit 4b5d1ba1 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 46509a57
......@@ -249,7 +249,8 @@ def StructureOf(znode, onlyKeys=False):
# Restructure reorganizes ZODB BTree instance (not Tree) according to specified
# topology structure.
#
# The new structure should be given with key-only buckets.
# The new structure should be usually given with key-only buckets.
# If new structure comes with values, values associated with keys must not be changed.
#
# NOTE ZODB BTree package does not tolerate structures with empty BTree nodes
# except for the sole single case of empty tree.
......@@ -498,7 +499,7 @@ def Restructure(ztree, newStructure):
assert len(node.keyv) == len(node.valuev)
for (k,v) in zip(node.keyv, node.valuev):
if kv[k] is not v:
raise ValueError("target bucket changes [%d] %r -> %r", k, kv[k], v)
raise ValueError("target bucket changes [%d] %r -> %r" % (k, kv[k], v))
zstate = ()
for k in node.keyv:
......
......@@ -687,7 +687,9 @@ def test_restructure():
assert b0[0] is X[0]
assert b2[2] is X[2]
# XXX raises if k->v different
# [2] changes value from X[2] to X[3]
with raises(ValueError, match=r"target bucket changes \[2\]"):
R(z, T([1], Bv([0],X[0]), Bv([2],X[3])))
# ---- tricky cases
......
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