Пример #1
0
 def test_min_nonoverlapping(self):
     r = Interval.min_nonoverlapping(Interval(1, 2), Interval(4, 7), Interval(8, 9))
     self.assertEqual(3, len(r))
     r = Interval.min_nonoverlapping(Interval(1, 5), Interval(4, 7), Interval(8, 9))
     self.assertEqual(2, len(r))
     r = Interval.min_nonoverlapping(Interval(1, 5), Interval(4, 7), Interval(7, 9))
     self.assertEqual([Interval(1, 9)], r)
     r = Interval.min_nonoverlapping((1, 2), (2, 4))
     self.assertEqual([Interval(1, 4)], r)
     self.assertEqual([], Interval.min_nonoverlapping())
Пример #2
0
 def test_min_nonoverlapping(self):
     r = Interval.min_nonoverlapping(Interval(1, 2), Interval(4, 7),
                                     Interval(8, 9))
     assert len(r) == 3
     r = Interval.min_nonoverlapping(Interval(1, 5), Interval(4, 7),
                                     Interval(8, 9))
     assert len(r) == 2
     r = Interval.min_nonoverlapping(Interval(1, 5), Interval(4, 7),
                                     Interval(7, 9))
     assert r == [Interval(1, 9)]
     r = Interval.min_nonoverlapping((1, 2), (2, 4))
     assert r == [Interval(1, 4)]
     assert Interval.min_nonoverlapping() == []