| 2564 | assert await r.lrange("a", 0, -1) == [b"1", b"2", b"3", b"4", b"5"] |
| 2565 | |
| 2566 | async def test_lrem(self, r: redis.Redis): |
| 2567 | await r.rpush("a", "Z", "b", "Z", "Z", "c", "Z", "Z") |
| 2568 | # remove the first 'Z' item |
| 2569 | assert await r.lrem("a", 1, "Z") == 1 |
| 2570 | assert await r.lrange("a", 0, -1) == [b"b", b"Z", b"Z", b"c", b"Z", b"Z"] |
| 2571 | # remove the last 2 'Z' items |
| 2572 | assert await r.lrem("a", -2, "Z") == 2 |
| 2573 | assert await r.lrange("a", 0, -1) == [b"b", b"Z", b"Z", b"c"] |
| 2574 | # remove all 'Z' items |
| 2575 | assert await r.lrem("a", 0, "Z") == 2 |
| 2576 | assert await r.lrange("a", 0, -1) == [b"b", b"c"] |
| 2577 | |
| 2578 | async def test_lset(self, r: redis.Redis): |
| 2579 | await r.rpush("a", "1", "2", "3") |