s1 = Spans(3, 4) # 3,4,5,6
self._check1(s1)
+ s1 = Spans(3L, 4L) # 3,4,5,6
+ self._check1(s1)
+
s2 = Spans(s1)
self._check1(s2)
self.failIf((7,1) in s)
self.failUnlessEqual(list(s.each()), [3,4,5,6])
+ def test_large(self):
+ s = Spans(4, 2**65) # don't do this with a SimpleSpans
+ self.failUnlessEqual(list(s), [(4, 2**65)])
+ self.failUnless(s)
+ self.failUnlessEqual(s.len(), 2**65)
+ self.failIf((0,1) in s)
+ self.failUnless((4,2) in s)
+ self.failUnless((2**65,2) in s)
+
def test_math(self):
s1 = Spans(0, 10) # 0,1,2,3,4,5,6,7,8,9
s2 = Spans(5, 3) # 5,6,7
ds.add(3, "ea")
self.failUnlessEqual(ds.get(2, 4), "fear")
+ ds = klass()
+ ds.add(2L, "four")
+ ds.add(3L, "ea")
+ self.failUnlessEqual(ds.get(2L, 4L), "fear")
+
+
def do_scan(self, klass):
# do a test with gaps and spans of size 1 and 2
# left=(1,11) * right=(1,11) * gapsize=(1,2)
yield s
def __nonzero__(self): # this gets us bool()
- return self.len()
+ return bool(self.len())
def len(self):
# guess what! python doesn't allow __len__ to return a long, only an
self.add(start, data)
def __nonzero__(self): # this gets us bool()
- return self.len()
+ return bool(self.len())
def len(self):
# return number of bytes we're holding