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, [])
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])
def test_len(self): tier = Tier('abc', 0, 1, ['a', 'b', 'c']) assert_equal(len(tier), 3)
def test_iter(self): tier = Tier('abc', 0, 1, ['a', 'b', 'c']) assert_equal(list(iter(tier)), ['a', 'b', 'c'])
def test_reversed(self): tier = Tier('abc', 0, 1, ['a', 'b', 'c']) assert_equal(list(reversed(tier)), ['c', 'b', 'a'])
def test_del(self): tier = Tier('abc', 0, 1, ['a', 'b', 'c']) del tier[1] assert_equal(tier[1], 'c')
def test_slice(self): tier = Tier('abc', 0, 1, ['a', 'b', 'c', 'd']) assert_equal(tier[1:3], ['b', 'c'])
def test_get(self): tier = Tier('abc', 0, 1, ['a', 'b', 'c']) assert_equal(tier[1], 'b')
def test_init_unsortable(self): with assert_raises(TypeError): Tier('abc', 0, 1, [Interval(0, 1, 'abc'), Point(0.5, 'abc')])