python tester now sometimes uses has_incomplete_versionstamp

This commit is contained in:
Alec Grieser 2017-10-11 11:00:16 -07:00
parent 9fd934e002
commit 5e44aa06e4
1 changed files with 12 additions and 9 deletions

View File

@ -457,15 +457,18 @@ class Tester:
prefix = inst.pop()
count = inst.pop()
items = inst.pop(count)
try:
packed = fdb.tuple.pack_with_versionstamp(tuple(items), prefix=prefix)
inst.push(b"OK")
inst.push(packed)
except ValueError as e:
if str(e).startswith("No incomplete"):
inst.push(b"ERROR: NONE")
else:
inst.push(b"ERROR: MULTIPLE")
if not fdb.tuple.has_incomplete_versionstamp(items) and random.random() < 0.5:
inst.push(b"ERROR: NONE")
else:
try:
packed = fdb.tuple.pack_with_versionstamp(tuple(items), prefix=prefix)
inst.push(b"OK")
inst.push(packed)
except ValueError as e:
if str(e).startswith("No incomplete"):
inst.push(b"ERROR: NONE")
else:
inst.push(b"ERROR: MULTIPLE")
elif inst.op == six.u("TUPLE_UNPACK"):
for i in fdb.tuple.unpack( inst.pop() ):
inst.push(fdb.tuple.pack((i,)))