示例#1
0
 def test_query(self):
     """ Test the behavior of b-tree-querying. """
     tree = Btree()
     tree.append((1, 9))
     tree.append((5, 11))
     tree.append((9, 9))
     self.assertEqual([(1, 9), (5, 11), (9, 9)],
                      tree.query(TimeSpan(0, 30), 1))
     self.assertEqual([(5, 11), (9, 9)], tree.query(TimeSpan(5, 30), 1))
     self.assertEqual([], tree.query(TimeSpan(20, 30), 1))
示例#2
0
 def test_no_overlap2(self):
     self.assertFalse(TimeSpan(10, 13).overlaps(TimeSpan(6, 7)))
示例#3
0
 def test_overlap3_reversed(self):
     self.assertTrue(TimeSpan(6, 17).overlaps(TimeSpan(8, 19)))
示例#4
0
 def test_overlap1_reversed(self):
     self.assertTrue(TimeSpan(6, 17).overlaps(TimeSpan(1, 8)))
示例#5
0
 def test_overlap3(self):
     self.assertTrue(TimeSpan(8, 19).overlaps(TimeSpan(6, 17)))
示例#6
0
 def test_overlap1(self):
     self.assertTrue(TimeSpan(1, 8).overlaps(TimeSpan(6, 17)))