diff options
author | Konstantin Merenkov <kmerenkov@gmail.com> | 2010-04-16 18:16:44 +0800 |
---|---|---|
committer | Andy McCurdy <andy@andymccurdy.com> | 2010-04-17 01:24:07 +0800 |
commit | 8b58178a946d7a846f4ff8f4b5d75243554bf8ec (patch) | |
tree | 10bc0b198fe8e43bfa4407fb18ce93eb0b142667 /tests/server_commands.py | |
parent | 40a8ff22e39009e5cc98538ab4ff781e31511d31 (diff) | |
download | redis-py-8b58178a946d7a846f4ff8f4b5d75243554bf8ec.tar.gz |
HMGET + tests
Diffstat (limited to 'tests/server_commands.py')
-rw-r--r-- | tests/server_commands.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/server_commands.py b/tests/server_commands.py index 45b82c7..e90d680 100644 --- a/tests/server_commands.py +++ b/tests/server_commands.py @@ -722,6 +722,17 @@ class ServerCommandsTestCase(unittest.TestCase): self.assertEqual(self.client.hgetall('foo'), d) self.assertRaises(redis.ResponseError, self.client.hmset, 'foo', {}) + def test_hmget(self): + d = {'a': 1, 'b': 2, 'c': 3} + self.assert_(self.client.hmset('foo', d)) + self.assertEqual(self.client.hmget('foo', ['a', 'b', 'c']), ['1', '2', '3']) + self.assertEqual(self.client.hmget('foo', ['a', 'c']), ['1', '3']) + + def test_hmget_empty(self): + self.assertEqual(self.client.hmget('foo', ['a', 'b']), [None, None]) + + def test_hmget_no_keys(self): + self.assertRaises(redis.ResponseError, self.client.hmget, 'foo', []) def test_hdel(self): # key is not a hash |