summaryrefslogtreecommitdiff
path: root/tests/test_commands.py
diff options
context:
space:
mode:
authorMarek Czaplicki <mdczaplicki@gmail.com>2022-03-06 13:29:01 +0100
committerGitHub <noreply@github.com>2022-03-06 14:29:01 +0200
commit6c798df564b644bdad1d7e09f1d750e4fee34848 (patch)
treef666b6c462a510b5c78c4922277361a2e68fd10e /tests/test_commands.py
parent98fd06eb8df1ecc109b4a5fb2d2a2e810142283e (diff)
downloadredis-py-6c798df564b644bdad1d7e09f1d750e4fee34848.tar.gz
Add support for HSET items (#2006)
* Add `items` parameter to `hset` * Add test for `hset` with `items` * Update CHANGES * fix test_profile Co-authored-by: Chayim <chayim@users.noreply.github.com> Co-authored-by: dvora-h <dvora.heller@redis.com>
Diffstat (limited to 'tests/test_commands.py')
-rw-r--r--tests/test_commands.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_commands.py b/tests/test_commands.py
index dc10cde..46303e5 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -2546,6 +2546,17 @@ class TestRedisCommands:
assert r.hget("b", "2") == b"2"
assert r.hget("b", "foo") == b"bar"
+ def test_hset_with_key_values_passed_as_list(self, r):
+ r.hset("a", items=["1", 1, "2", 2, "3", 3])
+ assert r.hget("a", "1") == b"1"
+ assert r.hget("a", "2") == b"2"
+ assert r.hget("a", "3") == b"3"
+
+ r.hset("b", "foo", "bar", items=["1", 1, "2", 2])
+ assert r.hget("b", "1") == b"1"
+ assert r.hget("b", "2") == b"2"
+ assert r.hget("b", "foo") == b"bar"
+
def test_hset_without_data(self, r):
with pytest.raises(exceptions.DataError):
r.hset("x")