Ejemplo n.º 1
0
 def test_breakpoint_constructor(self):
     b = Breakpoint('1', 10, 50)
     self.assertEqual(10, b[0])
     self.assertEqual(50, b[1])
     self.assertTrue(Interval.overlaps((1, 10), b))
     self.assertTrue(Interval.overlaps((50, 55), b))
     self.assertFalse(Interval.overlaps((1, 9), b))
Ejemplo n.º 2
0
 def test_breakpoint_constructor(self):
     b = Breakpoint('1', 10, 50)
     assert b[0] == 10
     assert b[1] == 50
     assert Interval.overlaps((1, 10), b)
     assert Interval.overlaps((50, 55), b)
     assert not Interval.overlaps((1, 9), b)
Ejemplo n.º 3
0
    def test_overlaps(self):
        left = Interval(-4, 1)
        middle = Interval(0, 10)
        right = Interval(5, 12)
        assert not Interval.overlaps(left, right)
        assert not Interval.overlaps(right, left)
        assert Interval.overlaps(left, middle)
        assert Interval.overlaps(right, middle)
        assert Interval.overlaps(middle, left)
        assert Interval.overlaps(middle, right)
        assert Interval.overlaps((1, 2), (2, 5))
        left = Interval(1148432, 1149343)
        right = Interval(1149493, 1150024)
        assert not Interval.overlaps(left, right)

        left = Interval(-4, 0.1)
        middle = Interval(0, 10)
        right = Interval(0.11, 12)
        assert not Interval.overlaps(left, right)
        assert not Interval.overlaps(right, left)
        assert Interval.overlaps(left, middle)
        assert Interval.overlaps(right, middle)
        assert Interval.overlaps(middle, left)
        assert Interval.overlaps(middle, right)
Ejemplo n.º 4
0
    def test_overlaps(self):
        left = Interval(-4, 1)
        middle = Interval(0, 10)
        right = Interval(5, 12)
        self.assertFalse(Interval.overlaps(left, right))
        self.assertFalse(Interval.overlaps(right, left))
        self.assertTrue(Interval.overlaps(left, middle))
        self.assertTrue(Interval.overlaps(right, middle))
        self.assertTrue(Interval.overlaps(middle, left))
        self.assertTrue(Interval.overlaps(middle, right))
        self.assertTrue(Interval.overlaps((1, 2), (2, 5)))
        left = Interval(1148432, 1149343)
        right = Interval(1149493, 1150024)
        self.assertFalse(Interval.overlaps(left, right))

        left = Interval(-4, 0.1)
        middle = Interval(0, 10)
        right = Interval(0.11, 12)
        self.assertFalse(Interval.overlaps(left, right))
        self.assertFalse(Interval.overlaps(right, left))
        self.assertTrue(Interval.overlaps(left, middle))
        self.assertTrue(Interval.overlaps(right, middle))
        self.assertTrue(Interval.overlaps(middle, left))
        self.assertTrue(Interval.overlaps(middle, right))