Esempio n. 1
0
    def test_where(self):
        int1 = Interval(0, 0.5, 'a')
        int2 = Interval(0.5, 0.6, 'b')
        int3 = Interval(0.75, 1, 'c')
        tier = IntervalTier('abc', 0, 1, [int1, int2, int3])

        assert_is(tier.where(0), int1)
        assert_is(tier.where(0.25), int1)

        assert_is(tier.where(0.5), int2)
        assert_is(tier.where(0.55), int2)

        assert_is_none(tier.where(0.6))
        assert_is_none(tier.where(0.65))

        assert_is(tier.where(0.75), int3)
        assert_is(tier.where(0.8), int3)

        assert_is_none(tier.where(1))
Esempio n. 2
0
    def test_where(self):
        int1 = Interval(0, 0.5, 'a')
        int2 = Interval(0.5, 0.6, 'b')
        int3 = Interval(0.75, 1, 'c')
        tier = IntervalTier('abc', 0, 1, [int1, int2, int3])

        assert_is(tier.where(0), int1)
        assert_is(tier.where(0.25), int1)

        assert_is(tier.where(0.5), int2)
        assert_is(tier.where(0.55), int2)

        assert_is_none(tier.where(0.6))
        assert_is_none(tier.where(0.65))

        assert_is(tier.where(0.75), int3)
        assert_is(tier.where(0.8), int3)

        assert_is_none(tier.where(1))
Esempio n. 3
0
    def test_where_out_of_bounds(self):
        interval = Interval(0.35, 0.5, 'a')
        tier = IntervalTier('abc', 0.25, 1, [interval])

        assert_is_none(tier.where(0.1))
        assert_is_none(tier.where(1.5))
Esempio n. 4
0
    def test_where_out_of_bounds(self):
        interval = Interval(0.35, 0.5, 'a')
        tier = IntervalTier('abc', 0.25, 1, [interval])

        assert_is_none(tier.where(0.1))
        assert_is_none(tier.where(1.5))