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

Function test_arrpop

tests/test_json.py:348–362  ·  view source on GitHub ↗
(client)

Source from the content-addressed store, hash-verified

346
347@pytest.mark.redismod
348def test_arrpop(client):
349 client.json().set("arr", Path.root_path(), [0, 1, 2, 3, 4])
350 assert 4 == client.json().arrpop("arr", Path.root_path(), 4)
351 assert 3 == client.json().arrpop("arr", Path.root_path(), -1)
352 assert 2 == client.json().arrpop("arr", Path.root_path())
353 assert 0 == client.json().arrpop("arr", Path.root_path(), 0)
354 assert [1] == client.json().get("arr")
355
356 # test out of bounds
357 client.json().set("arr", Path.root_path(), [0, 1, 2, 3, 4])
358 assert 4 == client.json().arrpop("arr", Path.root_path(), 99)
359
360 # none test
361 client.json().set("arr", Path.root_path(), [])
362 assert client.json().arrpop("arr") is None
363
364
365@pytest.mark.redismod

Callers

nothing calls this directly

Calls 5

root_pathMethod · 0.80
arrpopMethod · 0.80
setMethod · 0.45
jsonMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected