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

Function test_objkeys

tests/test_asyncio/test_json.py:411–424  ·  view source on GitHub ↗
(decoded_r: redis.Redis)

Source from the content-addressed store, hash-verified

409
410@pytest.mark.redismod
411async def test_objkeys(decoded_r: redis.Redis):
412 obj = {"foo": "bar", "baz": "qaz"}
413 await decoded_r.json().set("obj", Path.root_path(), obj)
414 keys = await decoded_r.json().objkeys("obj", Path.root_path())
415 keys.sort()
416 exp = list(obj.keys())
417 exp.sort()
418 assert exp == keys
419
420 await decoded_r.json().set("obj", Path.root_path(), obj)
421 keys = await decoded_r.json().objkeys("obj")
422 assert keys == list(obj.keys())
423
424 assert await decoded_r.json().objkeys("fakekey") is None
425
426
427@pytest.mark.redismod

Callers

nothing calls this directly

Calls 6

root_pathMethod · 0.80
objkeysMethod · 0.80
sortMethod · 0.80
keysMethod · 0.80
setMethod · 0.45
jsonMethod · 0.45

Tested by

no test coverage detected