summaryrefslogtreecommitdiffstats
path: root/tests/unittests/command_parse/test_hash_parse.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unittests/command_parse/test_hash_parse.py')
-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)