Skip to content

Commit

Permalink
added test for set method's parameters
Browse files Browse the repository at this point in the history
Signed-off-by: amirreza <[email protected]>
  • Loading branch information
amirreza8002 committed Dec 6, 2024
1 parent 0d21ea4 commit 4fea0e4
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,29 @@ def test_get_and_set(self, r):
assert r.get("integer") == str(integer).encode()
assert r.get("unicode_string").decode("utf-8") == unicode_string

def test_set_options_mutually_exclusive(self, r):
with pytest.raises(exceptions.DataError):
r.set("test", 1, ex=1, px=1)

with pytest.raises(exceptions.DataError):
r.set("test2", 2, exat=3, pxat=5)

with pytest.raises(exceptions.DataError):
r.set("test3", 3, ex=5, exat=1)

def test_set_options_type_check(self, r):
with pytest.raises(exceptions.DataError):
r.set("test", 1, ex="hi")

with pytest.raises(exceptions.DataError):
r.set("test1", 3, px=object())

with pytest.raises(exceptions.DataError):
r.set("test2", 2, exat=5.1)

with pytest.raises(exceptions.DataError):
r.set("test3", 1, pxat=3j)

@skip_if_server_version_lt("6.2.0")
def test_getdel(self, r):
assert r.getdel("a") is None
Expand Down

0 comments on commit 4fea0e4

Please sign in to comment.