MCPcopy
hub / github.com/redis/redis-py / test_lrem

Method test_lrem

tests/test_commands.py:3385–3395  ·  view source on GitHub ↗
(self, r)

Source from the content-addressed store, hash-verified

3383 assert r.lrange(b"345", 0, 0) == [b"12"]
3384
3385 def test_lrem(self, r):
3386 r.rpush("a", "Z", "b", "Z", "Z", "c", "Z", "Z")
3387 # remove the first 'Z' item
3388 assert r.lrem("a", 1, "Z") == 1
3389 assert r.lrange("a", 0, -1) == [b"b", b"Z", b"Z", b"c", b"Z", b"Z"]
3390 # remove the last 2 'Z' items
3391 assert r.lrem("a", -2, "Z") == 2
3392 assert r.lrange("a", 0, -1) == [b"b", b"Z", b"Z", b"c"]
3393 # remove all 'Z' items
3394 assert r.lrem("a", 0, "Z") == 2
3395 assert r.lrange("a", 0, -1) == [b"b", b"c"]
3396
3397 def test_lset(self, r):
3398 r.rpush("a", "1", "2", "3")

Callers

nothing calls this directly

Calls 3

rpushMethod · 0.80
lremMethod · 0.80
lrangeMethod · 0.80

Tested by

no test coverage detected