def test_many_items_last(self): mylist = OrderedList() mylist.add(1) mylist.add(2) mylist.add(3) assert mylist.pop(-1) == 3 assert mylist.size() == 2
def test_many_items_middle(self): mylist = OrderedList() mylist.add(1) mylist.add(2) mylist.add(3) assert mylist.pop(-2) == 2 assert mylist.size() == 2
def test_many_items_first(self): mylist = OrderedList() mylist.add(1) mylist.add(2) mylist.add(3) assert mylist.pop(0) == 1 assert mylist.size() == 2
def test_clear(self): mylist = OrderedList() mylist.add(1) mylist.add(2) mylist.add(3) mylist.clear() assert mylist.size() == 0 assert mylist.isEmpty() assert mylist.toList() == []
def test_size(self): mylist = OrderedList() mylist.add(1) mylist.add(2) assert mylist.size() == 2