summaryrefslogtreecommitdiffstats
path: root/tests/unittests/command_parse
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-08-15 12:04:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-08-15 12:04:44 +0000
commit92fdafd73450b0e27e354f3225e84e00e5d0b6cd (patch)
treedca744bab83dd06aa43d691925d7dce34ed0b58e /tests/unittests/command_parse
parentAdding upstream version 1.12.0. (diff)
downloadiredis-92fdafd73450b0e27e354f3225e84e00e5d0b6cd.tar.xz
iredis-92fdafd73450b0e27e354f3225e84e00e5d0b6cd.zip
Adding upstream version 1.12.1.upstream/1.12.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/unittests/command_parse')
-rw-r--r--tests/unittests/command_parse/test_hash_parse.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/unittests/command_parse/test_hash_parse.py b/tests/unittests/command_parse/test_hash_parse.py
index 0c3aa04..2bde9e0 100644
--- a/tests/unittests/command_parse/test_hash_parse.py
+++ b/tests/unittests/command_parse/test_hash_parse.py
@@ -43,3 +43,24 @@ def test_hset(judge_command):
"HSET foo bar hello",
{"command": "HSET", "key": "foo", "field": "bar", "value": "hello"},
)
+
+
+def test_hrandfield(judge_command):
+ judge_command(
+ "HRANDFIELD coin",
+ {"command": "HRANDFIELD", "key": "coin"},
+ )
+ judge_command(
+ "HRANDFIELD coin -5 WITHVALUES",
+ {
+ "command": "HRANDFIELD",
+ "key": "coin",
+ "count": "-5",
+ "withvalues_const": "WITHVALUES",
+ },
+ )
+ judge_command(
+ "HRANDFIELD coin -5",
+ {"command": "HRANDFIELD", "key": "coin", "count": "-5"},
+ )
+ judge_command("HRANDFIELD coin WITHVALUES", None)