Commit a4737403 authored by Jim Fulton's avatar Jim Fulton

Changed a test that checked the length of some btree items to

check the length after convering to a list, because btree items
have to lie about their length.
parent a29c27be
...@@ -83,9 +83,16 @@ ...@@ -83,9 +83,16 @@
# #
############################################################################## ##############################################################################
import sys, os, time, whrandom import sys, os, time, whrandom
sys.path.insert(0, '../..')
os.chdir('../..') print sys.path
import ZODB try:
sys.path.insert(0, '.')
import ZODB
except:
sys.path.insert(0, '../..')
#os.chdir('../..')
import ZODB
from BTrees.OOBTree import OOBTree from BTrees.OOBTree import OOBTree
from unittest import TestCase, TestSuite, TextTestRunner, makeSuite from unittest import TestCase, TestSuite, TextTestRunner, makeSuite
...@@ -139,7 +146,9 @@ class TestBTrees(TestCase): ...@@ -139,7 +146,9 @@ class TestBTrees(TestCase):
for x in v: for x in v:
assert x == i, (x,i) assert x == i, (x,i)
i = i + 1 i = i + 1
assert len(v) == 100, len(v) # BTree items must lie about their lengths, so we convert to list
assert len(list(v)) == 100, len(v)
#assert len(v) == 100, len(v)
def testItemsWorks(self): def testItemsWorks(self):
for x in range(100): for x in range(100):
...@@ -229,8 +238,8 @@ class TestBTrees(TestCase): ...@@ -229,8 +238,8 @@ class TestBTrees(TestCase):
added[k] = 1 added[k] = 1
addl = added.keys() addl = added.keys()
addl.sort() addl.sort()
diff = lsubtract(self.t.keys(), addl) diff = lsubtract(list(self.t.keys()), addl)
assert diff == [], diff assert diff == [], (diff, addl, list(self.t.keys()))
def testRandomOverlappingInserts(self): def testRandomOverlappingInserts(self):
added = {} added = {}
......
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