def test_remove_nonexistent(self): metasyntactic = RedisList(( 'foo', 'bar', 'baz', 'qux', 'quux', 'corge', 'grault', 'garply', 'waldo', 'fred', 'plugh', 'xyzzy', 'thud', )) with self.assertRaises(ValueError): metasyntactic.remove('raj')
def test_more_on_lists(self): a = RedisList((66.25, 333, 333, 1, 1234.5)) assert (a.count(333), a.count(66.25), a.count('x')) == (2, 1, 0) a.insert(2, -1) a.append(333) assert a == [66.25, 333, -1, 333, 1, 1234.5, 333] assert a.index(333) == 1 a.remove(333) assert a == [66.25, -1, 333, 1, 1234.5, 333] a.reverse() assert a == [333, 1234.5, 1, 333, -1, 66.25] a.sort() assert a == [-1, 1, 66.25, 333, 333, 1234.5] assert a.pop() == 1234.5 assert a == [-1, 1, 66.25, 333, 333]