def test_list_del(list): list.rpush('blah1', 'blah2', 'blah3') assert len(list) == 3 list.ltrim(0, 1) assert len(list) == 2 list.ltrim(0, 0) assert len(list) == 1
def test_list_read(list): list.rpush('blah1', 'blah2', 'blah3') all_elems = list.lrange(0, -1) assert all_elems == ['blah1', 'blah2', 'blah3'] assert list[1] == 'blah2' assert list.lindex(2) == 'blah3' right_elem = list.rpop() assert len(list) == 2 assert right_elem == 'blah3' left_elem = list.lpop() assert len(list) == 1 assert left_elem == 'blah1' left_elem = list.lpop() assert len(list) == 0 assert left_elem == 'blah2'
def test_list_push(list): list.rpush('blah1', 'blah2') assert len(list) == 2 list.lpush('blah0') assert len(list) == 3 assert list[0] == 'blah0'