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

Function test_hgetdel

tests/test_asyncio/test_hash.py:310–321  ·  view source on GitHub ↗
(r)

Source from the content-addressed store, hash-verified

308
309@skip_if_server_version_lt("7.9.0")
310async def test_hgetdel(r):
311 await r.delete("test:hash")
312 await r.hset("test:hash", "foo", "bar", mapping={"1": 1, "2": 2})
313 assert await r.hgetdel("test:hash", "foo", "1") == [b"bar", b"1"]
314 assert await r.hget("test:hash", "foo") is None
315 assert await r.hget("test:hash", "1") is None
316 assert await r.hget("test:hash", "2") == b"2"
317 assert await r.hgetdel("test:hash", "foo", "1") == [None, None]
318 assert await r.hget("test:hash", "2") == b"2"
319
320 with pytest.raises(exceptions.DataError):
321 await r.hgetdel("test:hash")
322
323
324@skip_if_server_version_lt("7.9.0")

Callers

nothing calls this directly

Calls 4

hsetMethod · 0.80
hgetdelMethod · 0.80
hgetMethod · 0.80
deleteMethod · 0.45

Tested by

no test coverage detected