예제 #1
0
    def test_init_no_items(self):
        tier = Tier('abc', 0, 1)

        assert_equal(tier.name, 'abc')
        assert_equal(tier.xmin, 0)
        assert_equal(tier.xmax, 1)
        assert_equal(tier._items, [])
예제 #2
0
    def test_init(self):
        tier = Tier('abc', 0, 1, [4, 2, 3])

        assert_equal(tier.name, 'abc')
        assert_equal(tier.xmin, 0)
        assert_equal(tier.xmax, 1)
        assert_equal(tier._items, [2, 3, 4])
예제 #3
0
 def test_len(self):
     tier = Tier('abc', 0, 1, ['a', 'b', 'c'])
     assert_equal(len(tier), 3)
예제 #4
0
 def test_iter(self):
     tier = Tier('abc', 0, 1, ['a', 'b', 'c'])
     assert_equal(list(iter(tier)), ['a', 'b', 'c'])
예제 #5
0
 def test_reversed(self):
     tier = Tier('abc', 0, 1, ['a', 'b', 'c'])
     assert_equal(list(reversed(tier)), ['c', 'b', 'a'])
예제 #6
0
 def test_del(self):
     tier = Tier('abc', 0, 1, ['a', 'b', 'c'])
     del tier[1]
     assert_equal(tier[1], 'c')
예제 #7
0
 def test_slice(self):
     tier = Tier('abc', 0, 1, ['a', 'b', 'c', 'd'])
     assert_equal(tier[1:3], ['b', 'c'])
예제 #8
0
 def test_get(self):
     tier = Tier('abc', 0, 1, ['a', 'b', 'c'])
     assert_equal(tier[1], 'b')
예제 #9
0
 def test_init_unsortable(self):
     with assert_raises(TypeError):
         Tier('abc', 0, 1, [Interval(0, 1, 'abc'), Point(0.5, 'abc')])