Commit 12a1857a authored by Tres Seaver's avatar Tres Seaver

Moar xrange compat.

parent 1b50c3ea
...@@ -473,6 +473,7 @@ class MappingBase(Base): ...@@ -473,6 +473,7 @@ class MappingBase(Base):
# This tests fixes to several bugs in this area, starting with # This tests fixes to several bugs in this area, starting with
# http://collector.zope.org/Zope/419, # http://collector.zope.org/Zope/419,
# "BTreeItems slice contains 1 too many elements". # "BTreeItems slice contains 1 too many elements".
from .._compat import xrange
t = self._makeOne() t = self._makeOne()
for n in range(10): for n in range(10):
t.clear() t.clear()
...@@ -1086,6 +1087,7 @@ class NormalSetTests(Base): ...@@ -1086,6 +1087,7 @@ class NormalSetTests(Base):
def testBigInsert(self): def testBigInsert(self):
from .._compat import PY2 from .._compat import PY2
from .._compat import xrange
t = self._makeOne() t = self._makeOne()
r = xrange(10000) r = xrange(10000)
for x in r: for x in r:
...@@ -1096,6 +1098,7 @@ class NormalSetTests(Base): ...@@ -1096,6 +1098,7 @@ class NormalSetTests(Base):
self.assert_(x in t) self.assert_(x in t)
def testRemoveSucceeds(self): def testRemoveSucceeds(self):
from .._compat import xrange
t = self._makeOne() t = self._makeOne()
r = xrange(10000) r = xrange(10000)
for x in r: t.insert(x) for x in r: t.insert(x)
...@@ -1115,6 +1118,7 @@ class NormalSetTests(Base): ...@@ -1115,6 +1118,7 @@ class NormalSetTests(Base):
self.assert_(1 not in t) self.assert_(1 not in t)
def testKeys(self): def testKeys(self):
from .._compat import xrange
t = self._makeOne() t = self._makeOne()
r = xrange(1000) r = xrange(1000)
for x in r: for x in r:
...@@ -1124,6 +1128,7 @@ class NormalSetTests(Base): ...@@ -1124,6 +1128,7 @@ class NormalSetTests(Base):
def testClear(self): def testClear(self):
from .._compat import xrange
t = self._makeOne() t = self._makeOne()
r = xrange(1000) r = xrange(1000)
for x in r: t.insert(x) for x in r: t.insert(x)
...@@ -1260,12 +1265,14 @@ class NormalSetTests(Base): ...@@ -1260,12 +1265,14 @@ class NormalSetTests(Base):
class ExtendedSetTests(NormalSetTests): class ExtendedSetTests(NormalSetTests):
def testLen(self): def testLen(self):
from .._compat import xrange
t = self._makeOne() t = self._makeOne()
r = xrange(10000) r = xrange(10000)
for x in r: t.insert(x) for x in r: t.insert(x)
self.assertEqual(len(t) , 10000, len(t)) self.assertEqual(len(t) , 10000, len(t))
def testGetItem(self): def testGetItem(self):
from .._compat import xrange
t = self._makeOne() t = self._makeOne()
r = xrange(10000) r = xrange(10000)
for x in r: t.insert(x) for x in r: t.insert(x)
......
...@@ -143,6 +143,7 @@ class _TestOIBTreesBase(TypeTest): ...@@ -143,6 +143,7 @@ class _TestOIBTreesBase(TypeTest):
self._makeOne()[1] = None self._makeOne()[1] = None
def testEmptyFirstBucketReportedByGuido(self): def testEmptyFirstBucketReportedByGuido(self):
from .._compat import xrange
b = self._makeOne() b = self._makeOne()
for i in xrange(29972): # reduce to 29971 and it works for i in xrange(29972): # reduce to 29971 and it works
b[i] = i b[i] = i
......
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