summaryrefslogtreecommitdiffstats
path: root/tests/unittests/command_parse/test_hash_parse.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2020-03-21 10:28:17 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-02-07 11:16:53 +0000
commit06cba6ccd165ca8b224797e37fccb9e63f026d77 (patch)
treee82f1bc439997ae296f2e74f8a64d84c5d95f140 /tests/unittests/command_parse/test_hash_parse.py
parentInitial commit. (diff)
downloadiredis-06cba6ccd165ca8b224797e37fccb9e63f026d77.tar.xz
iredis-06cba6ccd165ca8b224797e37fccb9e63f026d77.zip
Adding upstream version 1.9.1.upstream/1.9.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/unittests/command_parse/test_hash_parse.py')
-rw-r--r--tests/unittests/command_parse/test_hash_parse.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/unittests/command_parse/test_hash_parse.py b/tests/unittests/command_parse/test_hash_parse.py
new file mode 100644
index 0000000..0c3aa04
--- /dev/null
+++ b/tests/unittests/command_parse/test_hash_parse.py
@@ -0,0 +1,45 @@
+def test_hdel(judge_command):
+ judge_command("HDEL foo bar", {"command": "HDEL", "key": "foo", "fields": "bar"})
+ judge_command(
+ "HDEL foo bar hello world",
+ {"command": "HDEL", "key": "foo", "fields": "bar hello world"},
+ )
+
+
+def test_hmset(judge_command):
+ judge_command(
+ "HMSET foo bar hello-world",
+ {"command": "HMSET", "key": "foo", "field": "bar", "value": "hello-world"},
+ )
+ judge_command(
+ "HMSET foo bar hello-world key2 value2",
+ {"command": "HMSET", "key": "foo", "field": "key2", "value": "value2"},
+ )
+
+
+def test_hexists(judge_command):
+ judge_command(
+ "HEXISTS foo bar", {"command": "HEXISTS", "key": "foo", "field": "bar"}
+ )
+ judge_command("HEXISTS foo bar hello-world", None)
+
+
+def test_hincrby(judge_command):
+ judge_command(
+ "HINCRBY foo bar 12",
+ {"command": "HINCRBY", "key": "foo", "field": "bar", "delta": "12"},
+ )
+
+
+def test_hincrbyfloat(judge_command):
+ judge_command(
+ "HINCRBYFLOAT foo bar 12.1",
+ {"command": "HINCRBYFLOAT", "key": "foo", "field": "bar", "float": "12.1"},
+ )
+
+
+def test_hset(judge_command):
+ judge_command(
+ "HSET foo bar hello",
+ {"command": "HSET", "key": "foo", "field": "bar", "value": "hello"},
+ )