Skip to content

Commit fbb232e

Browse files
committed
test set method's parameters
Signed-off-by: amirreza <[email protected]>
1 parent d088ce2 commit fbb232e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/test_commands.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,26 @@ def test_get_and_set(self, r):
13201320
assert r.get("integer") == str(integer).encode()
13211321
assert r.get("unicode_string").decode("utf-8") == unicode_string
13221322

1323+
def test_set_options_mutually_exclusive(self, r):
1324+
with pytest.raises(exceptions.DataError):
1325+
r.set("test", 1, ex=1, px=1)
1326+
1327+
with pytest.raises(exceptions.DataError):
1328+
r.set("test2", 2, exat=3, pxat=5)
1329+
1330+
with pytest.raises(exceptions.DataError):
1331+
r.set("test3", 3, ex=5, exat=1)
1332+
1333+
def test_set_options_type_check(self, r):
1334+
with pytest.raises(exceptions.DataError):
1335+
r.set("test", 1, ex="hi")
1336+
1337+
with pytest.raises(exceptions.DataError):
1338+
r.set("test1", 3, px=object())
1339+
1340+
with pytest.raises(exceptions.DataError):
1341+
r.set("test3", 1, pxat=3j)
1342+
13231343
@skip_if_server_version_lt("6.2.0")
13241344
def test_getdel(self, r):
13251345
assert r.getdel("a") is None

0 commit comments

Comments
 (0)