Commits

Brent Pedersen committed d2d2abc

interval index file, make sure start is not > stop. added test.

Comments (0)

Files changed (2)

lib/bx/interval_index_file.py

     """Find the smallest bin that can contain interval (start,end)"""
     if offsets is None:
         offsets = BIN_OFFSETS
-    start_bin, end_bin = start, end - 1
+    start_bin, end_bin = start, max(start, end - 1)
     start_bin >>= BIN_FIRST_SHIFT
     end_bin >>= BIN_FIRST_SHIFT
     for offset in offsets:
         else:
             start_bin >>= BIN_NEXT_SHIFT
             end_bin >>= BIN_NEXT_SHIFT
-    raise "Interval (%d,%d) out of range"
+    raise Exceptionn("Interval (%d,%d) out of range")
 
 class AbstractMultiIndexedAccess( object ):
     """

lib/bx/interval_index_file_tests.py

             result = ix.find( name, start, end )
             for inter in result:
                 assert inter in query_intervals
-                
-            
-    
-    
 
-
-
-
-
-
+def test_zero():
+    ix = Indexes()
+    ix.add("t.idx", 0, 0, 1, 123)