summaryrefslogtreecommitdiff
path: root/tests/test_commands.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_commands.py')
-rw-r--r--tests/test_commands.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/test_commands.py b/tests/test_commands.py
index b2bd2da..15a76de 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -1587,7 +1587,7 @@ class TestRedisCommands(object):
# HASH COMMANDS
def test_hget_and_hset(self, r):
- r.hmset('a', {'1': 1, '2': 2, '3': 3})
+ r.hmset('a', mapping={'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'
@@ -1603,6 +1603,21 @@ class TestRedisCommands(object):
# key inside of hash that doesn't exist returns null value
assert r.hget('a', 'b') is None
+ def test_hset_with_multi_key_values(self, r):
+ r.hset('a', mapping={'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", mapping={'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")
+
def test_hdel(self, r):
r.hmset('a', {'1': 1, '2': 2, '3': 3})
assert r.hdel('a', '2') == 1