(self, r: redis.Redis)
| 3434 | |
| 3435 | # SORTED SET COMMANDS |
| 3436 | async def test_zadd(self, r: redis.Redis): |
| 3437 | mapping = {"a1": 1.0, "a2": 2.0, "a3": 3.0} |
| 3438 | await r.zadd("a", mapping) |
| 3439 | response = await r.zrange("a", 0, -1, withscores=True) |
| 3440 | assert_resp_response( |
| 3441 | r, |
| 3442 | response, |
| 3443 | [(b"a1", 1.0), (b"a2", 2.0), (b"a3", 3.0)], |
| 3444 | [[b"a1", 1.0], [b"a2", 2.0], [b"a3", 3.0]], |
| 3445 | ) |
| 3446 | |
| 3447 | # error cases |
| 3448 | with pytest.raises(exceptions.DataError): |
| 3449 | await r.zadd("a", {}) |
| 3450 | |
| 3451 | # cannot use both nx and xx options |
| 3452 | with pytest.raises(exceptions.DataError): |
| 3453 | await r.zadd("a", mapping, nx=True, xx=True) |
| 3454 | |
| 3455 | # cannot use the incr options with more than one value |
| 3456 | with pytest.raises(exceptions.DataError): |
| 3457 | await r.zadd("a", mapping, incr=True) |
| 3458 | |
| 3459 | async def test_zadd_nx(self, r: redis.Redis): |
| 3460 | assert await r.zadd("a", {"a1": 1}) == 1 |
nothing calls this directly
no test coverage detected