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

Method test_hrandfield

tests/test_asyncio/test_commands.py:2216–2226  ·  view source on GitHub ↗
(self, r)

Source from the content-addressed store, hash-verified

2214
2215 @skip_if_server_version_lt("6.2.0")
2216 async def test_hrandfield(self, r):
2217 assert await r.hrandfield("key") is None
2218 await r.hset("key", mapping={"a": 1, "b": 2, "c": 3, "d": 4, "e": 5})
2219 assert await r.hrandfield("key") is not None
2220 assert len(await r.hrandfield("key", 2)) == 2
2221 # with values
2222 assert_resp_response(r, len(await r.hrandfield("key", 2, True)), 4, 2)
2223 # without duplications
2224 assert len(await r.hrandfield("key", 10)) == 5
2225 # with duplications
2226 assert len(await r.hrandfield("key", -10)) == 10
2227
2228 @pytest.mark.onlynoncluster
2229 async def test_randomkey(self, r: redis.Redis):

Callers

nothing calls this directly

Calls 3

assert_resp_responseFunction · 0.90
hrandfieldMethod · 0.80
hsetMethod · 0.80

Tested by

no test coverage detected