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

Function test_hsetex_expiration_px

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

Source from the content-addressed store, hash-verified

462
463@skip_if_server_version_lt("7.9.0")
464async def test_hsetex_expiration_px(r):
465 await r.delete("test:hash")
466 # set items from key/value provided and mapping
467 # with expiration - testing px field
468 assert (
469 await r.hsetex("test:hash", "foo", "bar", mapping={"1": 1, "2": "2"}, px=60000)
470 == 1
471 )
472 test_keys = ["foo", "1", "2"]
473 ttls = await r.httl("test:hash", *test_keys)
474 for ttl in ttls:
475 assert pytest.approx(ttl) == 60
476
477 assert await r.hgetex("test:hash", *test_keys) == [b"bar", b"1", b"2"]
478
479
480@skip_if_server_version_lt("7.9.0")

Callers

nothing calls this directly

Calls 4

hsetexMethod · 0.80
httlMethod · 0.80
hgetexMethod · 0.80
deleteMethod · 0.45

Tested by

no test coverage detected