コード例 #1
0
 def testMultiple(self):
     """test empty input."""
     self.assertEqual(Intervals.intersect([(0, 5), (10, 15)], [(0, 5)]),
                      [(0, 5)])
     self.assertEqual(Intervals.intersect([(0, 5), (10, 15)], [(0, 10)]),
                      [(0, 5)])
     self.assertEqual(Intervals.intersect([(0, 5), (10, 15)], [(0, 15)]),
                      [(0, 5), (10, 15)])
     self.assertEqual(Intervals.intersect([(0, 5), (5, 10)], [(0, 10)]),
                      [(0, 5), (5, 10)])
コード例 #2
0
 def testSingle(self):
     """test empty input."""
     self.assertEqual(Intervals.intersect([(0, 5)], [(0, 5)]), [(0, 5)])
     self.assertEqual(Intervals.intersect([(0, 5)], [(0, 3)]), [(0, 3)])
     self.assertEqual(Intervals.intersect([(0, 3)], [(0, 5)]), [(0, 3)])
     self.assertEqual(Intervals.intersect([(0, 5)], [(3, 5)]), [(3, 5)])
     self.assertEqual(Intervals.intersect([(3, 5)], [(0, 5)]), [(3, 5)])
     self.assertEqual(Intervals.intersect([(5, 10)], [(5, 20)]), [(5, 10)])
     self.assertEqual(Intervals.intersect([(5, 10)], [(0, 20)]), [(5, 10)])
コード例 #3
0
 def testNoOverlap(self):
     """test empty input."""
     self.assertEqual(Intervals.intersect([(0, 5), (10, 15)], [(5, 10)]),
                      [])
     self.assertEqual(Intervals.intersect([(5, 10)], [(0, 5), (10, 15)]),
                      [])
コード例 #4
0
 def testHalfEmpty(self):
     """test empty input."""
     self.assertEqual(Intervals.intersect([(0, 5)], []), [])
     self.assertEqual(Intervals.intersect([], [(0, 5)]), [])
コード例 #5
0
 def testEmpty(self):
     """test empty input."""
     self.assertEqual(Intervals.intersect([], []), [])