Skip to content

Commit 5f99011

Browse files
committed
fixes redis#76 where ZREVRANK was using the wrong response callback
1 parent 9fea093 commit 5f99011

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

CHANGES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
* 2.2.2
2+
* Fixed a bug in ZREVRANK where retriving the rank of a value not in
3+
the zset would raise an error.
14
* 2.2.1
25
* Changed archive name to redis-py-VERSION.tar.gz to not conflict
36
with the Redis server archive.

redis/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class Redis(threading.local):
218218
string_keys_to_dict(
219219
'DECRBY GETBIT HLEN INCRBY LINSERT LLEN LPUSHX RPUSHX SCARD '
220220
'SDIFFSTORE SETBIT SETRANGE SINTERSTORE STRLEN SUNIONSTORE ZCARD '
221-
'ZREMRANGEBYRANK ZREMRANGEBYSCORE ZREVRANK',
221+
'ZREMRANGEBYRANK ZREMRANGEBYSCORE',
222222
int
223223
),
224224
string_keys_to_dict(
@@ -237,6 +237,7 @@ class Redis(threading.local):
237237
lambda r: r and set(r) or set()
238238
),
239239
string_keys_to_dict('ZRANGE ZRANGEBYSCORE ZREVRANGE', zset_score_pairs),
240+
string_keys_to_dict('ZRANK ZREVRANK', int_or_none),
240241
{
241242
'BGREWRITEAOF': lambda r: \
242243
r == 'Background rewriting of AOF file started',
@@ -249,7 +250,6 @@ class Redis(threading.local):
249250
'PING': lambda r: r == 'PONG',
250251
'RANDOMKEY': lambda r: r and r or None,
251252
'TTL': lambda r: r != -1 and r or None,
252-
'ZRANK': int_or_none,
253253
}
254254
)
255255

tests/server_commands.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,7 @@ def test_zrevrank(self):
891891
self.assertEquals(self.client.zrevrank('a', 'a3'), 2)
892892
self.assertEquals(self.client.zrevrank('a', 'a4'), 3)
893893
self.assertEquals(self.client.zrevrank('a', 'a5'), 4)
894+
self.assertEquals(self.client.zrevrank('a', 'b'), None)
894895

895896
def test_zscore(self):
896897
# key is not a zset

0 commit comments

Comments
 (0)