diff --git a/tests/test_dict.py b/tests/test_dict.py index 590657a..aca7894 100644 --- a/tests/test_dict.py +++ b/tests/test_dict.py @@ -346,3 +346,20 @@ def test_dct_copy(client, request): with pytest.raises(ValueError): dct.copy(key="list:test:copy") + + +@pytest.mark.parametrize("client", ["znsclient", "znsclient_w_redis", "redisclient"]) +def test_dct_pop(client, request): + c = request.getfixturevalue(client) + dct = znsocket.Dict(r=c, key="list:test") + assert isinstance(dct, ZnSocketObject) + + dct.update({"a": "1", "b": "2"}) + + assert dct.pop("a") == "1" + assert dct == {"b": "2"} + + with pytest.raises(KeyError): + dct.pop("a") + + assert dct.pop("a", "default") == "default"