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

Method test_msetex_expiration_px

tests/test_commands.py:2639–2652  ·  view source on GitHub ↗
(self, r)

Source from the content-addressed store, hash-verified

2637 @pytest.mark.onlynoncluster
2638 @skip_if_server_version_lt("8.3.224")
2639 def test_msetex_expiration_px(self, r):
2640 all_test_keys = ["1", "2"]
2641 for key in all_test_keys:
2642 r.delete(key)
2643
2644 mapping = {"1": 1, "2": "2"}
2645 # set key/value pairs provided in mapping
2646 # with expiration - testing px field
2647 assert r.msetex(mapping=mapping, px=60000) == 1
2648
2649 ttls = [r.ttl(key) for key in mapping.keys()]
2650 for ttl in ttls:
2651 assert pytest.approx(ttl) == 60
2652 assert r.mget(*mapping.keys()) == [b"1", b"2"]
2653
2654 @pytest.mark.onlynoncluster
2655 @skip_if_server_version_lt("8.3.224")

Callers

nothing calls this directly

Calls 5

msetexMethod · 0.80
keysMethod · 0.80
deleteMethod · 0.45
ttlMethod · 0.45
mgetMethod · 0.45

Tested by

no test coverage detected