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

Function test_hsetex_expiration_px

tests/test_hash.py:512–523  ·  view source on GitHub ↗
(r)

Source from the content-addressed store, hash-verified

510
511@skip_if_server_version_lt("7.9.0")
512def test_hsetex_expiration_px(r):
513 r.delete("test:hash")
514 # set items from key/value provided and mapping
515 # with expiration - testing px field
516 assert (
517 r.hsetex("test:hash", "foo", "bar", mapping={"1": 1, "2": "2"}, px=60000) == 1
518 )
519 test_keys = ["foo", "1", "2"]
520 ttls = r.httl("test:hash", *test_keys)
521 for ttl in ttls:
522 assert pytest.approx(ttl) == 60
523 assert r.hgetex("test:hash", *test_keys) == [b"bar", b"1", b"2"]
524
525
526@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