コード例 #1
0
    def test_position_in_range(self):
        pos = (12, 12)
        self.assertEqual((2, False), Interval.position_in_range([(1, 2), (3, 6), (7, 15)], pos))
        self.assertEqual(
            (3, True), Interval.position_in_range([(1, 2), (3, 6), (7, 10), (14, 16)], pos)
        )
        self.assertEqual((3, False), Interval.position_in_range([(1, 2), (3, 6), (7, 10)], pos))
        self.assertEqual((0, True), Interval.position_in_range([(15, 16), (17, 19)], pos))

        with self.assertRaises(AttributeError):
            Interval.position_in_range([], 1)
コード例 #2
0
ファイル: test_interval.py プロジェクト: bcgsc/mavis
    def test_position_in_range(self):
        pos = (12, 12)
        assert Interval.position_in_range([(1, 2), (3, 6), (7, 15)],
                                          pos) == (2, False)
        assert Interval.position_in_range([(1, 2), (3, 6), (7, 10), (14, 16)],
                                          pos) == (3, True)
        assert Interval.position_in_range([(1, 2), (3, 6), (7, 10)],
                                          pos) == (3, False)
        assert Interval.position_in_range([(15, 16), (17, 19)],
                                          pos) == (0, True)

        with pytest.raises(AttributeError):
            Interval.position_in_range([], 1)