def test_modifications_during_reversed(self): chars = ItemList(str, items='yxdba') for c in reversed(chars): if c == 'a': chars.remove('x') if c == 'b': chars.insert(-2, 'c') if c == 'c': chars.pop(0) if c == 'd': chars.insert(0, 'e') assert_true(c in 'abcde', '%s was unexpected here!' % c) assert_equal(list(chars), list('edcba'))
def test_remove(self): items = ItemList(str, items='abcba') items.remove('c') assert_equal(list(items), list('abba')) items.remove('a') assert_equal(list(items), list('bba')) items.remove('b') items.remove('a') items.remove('b') assert_equal(list(items), list('')) assert_raises(ValueError, items.remove, 'nonex')