summaryrefslogtreecommitdiff
path: root/tests/server_commands.py
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2010-03-10 13:34:03 -0800
committerAndy McCurdy <andy@andymccurdy.com>2010-03-10 13:34:03 -0800
commit9e3e1aa43456202e86e241955f3ae7f5220f5d58 (patch)
tree3971bc5e41af62ac61ee1252bf656fde35c62c82 /tests/server_commands.py
parentc83542e58593fd0ce6347f399b65763abfebcccb (diff)
downloadredis-py-9e3e1aa43456202e86e241955f3ae7f5220f5d58.tar.gz
added HGET/HSET commands
removed the KEYS callback -- 1.34 Redis servers now return KEYS with the multi-bulk protocol, which means they're already in a list
Diffstat (limited to 'tests/server_commands.py')
-rw-r--r--tests/server_commands.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/server_commands.py b/tests/server_commands.py
index a245856..4bdbcf4 100644
--- a/tests/server_commands.py
+++ b/tests/server_commands.py
@@ -648,6 +648,28 @@ class ServerCommandsTestCase(unittest.TestCase):
self.make_zset('a', {'a1' : 1, 'a2' : 2, 'a3' : 3})
self.assertEquals(self.client.zscore('a', 'a2'), 2.0)
+ # HASHES
+ def make_hash(self, key, d):
+ for k,v in d.iteritems():
+ self.client.hset(key, k, v)
+
+ def test_hget_and_hset(self):
+ # TODO: add these back in, but right now they produce a crash bug.
+ # key is not a hash
+ # self.client['a'] = 'a'
+ # self.assertRaises(redis.ResponseError, self.client.hget, 'a', 'a1')
+ # del self.client['a']
+ # no key
+ self.assertEquals(self.client.hget('a', 'a1'), None)
+ # real logic
+ self.make_hash('a', {'a1': 1, 'a2': 2, 'a3': 3})
+ self.assertEquals(self.client.hget('a', 'a1'), '1')
+ self.assertEquals(self.client.hget('a', 'a2'), '2')
+ self.assertEquals(self.client.hget('a', 'a3'), '3')
+ # TODO: Not sure why these don't wokr
+ # self.assertEquals(self.client.hset('a', 'a2', 5), True)
+ # self.assertEquals(self.client.hget('a', 'a2'), '5')
+
# SORT
def test_sort_bad_key(self):
# key is not set