コード例 #1
0
    def test_labels_in_range_returns_only_fully_included(self):
        ll = LabelList(labels=[
            Label('a', 3.2, 4.5),
            Label('b', 5.1, 8.9),
            Label('c', 7.2, 10.5),
            Label('a', 10.5, 14),
            Label('c', 13, 15)
        ])

        in_range = ll.labels_in_range(7.2, 14.99, fully_included=True)

        assert sorted(in_range) == [
            Label('c', 7.2, 10.5),
            Label('a', 10.5, 14),
        ]
コード例 #2
0
    def test_labels_in_range(self):
        ll = LabelList(labels=[
            Label('a', 3.2, 4.5),
            Label('b', 5.1, 8.9),
            Label('c', 7.2, 10.5),
            Label('a', 10.5, 14),
            Label('c', 13, 14)
        ])

        in_range = ll.labels_in_range(8.2, 12.5)

        assert sorted(in_range) == [
            Label('b', 5.1, 8.9),
            Label('c', 7.2, 10.5),
            Label('a', 10.5, 14)
        ]