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))
def test_no_overlap2(self): self.assertFalse(TimeSpan(10, 13).overlaps(TimeSpan(6, 7)))
def test_overlap3_reversed(self): self.assertTrue(TimeSpan(6, 17).overlaps(TimeSpan(8, 19)))
def test_overlap1_reversed(self): self.assertTrue(TimeSpan(6, 17).overlaps(TimeSpan(1, 8)))
def test_overlap3(self): self.assertTrue(TimeSpan(8, 19).overlaps(TimeSpan(6, 17)))
def test_overlap1(self): self.assertTrue(TimeSpan(1, 8).overlaps(TimeSpan(6, 17)))