diff options
-rw-r--r-- | CHANGES | 3 | ||||
-rw-r--r-- | redis/client.py | 4 | ||||
-rw-r--r-- | tests/server_commands.py | 1 |
3 files changed, 6 insertions, 2 deletions
@@ -1,3 +1,6 @@ +* 2.2.2 + * Fixed a bug in ZREVRANK where retriving the rank of a value not in + the zset would raise an error. * 2.2.1 * Changed archive name to redis-py-VERSION.tar.gz to not conflict with the Redis server archive. diff --git a/redis/client.py b/redis/client.py index 967bcee..d173d26 100644 --- a/redis/client.py +++ b/redis/client.py @@ -218,7 +218,7 @@ class Redis(threading.local): string_keys_to_dict( 'DECRBY GETBIT HLEN INCRBY LINSERT LLEN LPUSHX RPUSHX SCARD ' 'SDIFFSTORE SETBIT SETRANGE SINTERSTORE STRLEN SUNIONSTORE ZCARD ' - 'ZREMRANGEBYRANK ZREMRANGEBYSCORE ZREVRANK', + 'ZREMRANGEBYRANK ZREMRANGEBYSCORE', int ), string_keys_to_dict( @@ -237,6 +237,7 @@ class Redis(threading.local): lambda r: r and set(r) or set() ), string_keys_to_dict('ZRANGE ZRANGEBYSCORE ZREVRANGE', zset_score_pairs), + string_keys_to_dict('ZRANK ZREVRANK', int_or_none), { 'BGREWRITEAOF': lambda r: \ r == 'Background rewriting of AOF file started', @@ -249,7 +250,6 @@ class Redis(threading.local): 'PING': lambda r: r == 'PONG', 'RANDOMKEY': lambda r: r and r or None, 'TTL': lambda r: r != -1 and r or None, - 'ZRANK': int_or_none, } ) diff --git a/tests/server_commands.py b/tests/server_commands.py index 2738e91..5cd63c5 100644 --- a/tests/server_commands.py +++ b/tests/server_commands.py @@ -891,6 +891,7 @@ class ServerCommandsTestCase(unittest.TestCase): self.assertEquals(self.client.zrevrank('a', 'a3'), 2) self.assertEquals(self.client.zrevrank('a', 'a4'), 3) self.assertEquals(self.client.zrevrank('a', 'a5'), 4) + self.assertEquals(self.client.zrevrank('a', 'b'), None) def test_zscore(self): # key is not a zset |