Skip to content

Commit

Permalink
Dct-pop-test (#70)
Browse files Browse the repository at this point in the history
* fix `list.pop` by using Pipelines

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix test

* update test to reflect only positiv integers

* test `dict.pop`

* test with default value

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
PythonFZ and pre-commit-ci[bot] authored Nov 8, 2024
1 parent e53502a commit ef269da
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit ef269da

Please sign in to comment.