Skip to content

Commit

Permalink
Switched callback for SREM from bool to int.
Browse files Browse the repository at this point in the history
  • Loading branch information
ronniekk committed Jan 25, 2013
1 parent d908011 commit fcac7dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions redis/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,12 @@ class StrictRedis(object):
RESPONSE_CALLBACKS = dict_merge(
string_keys_to_dict(
'AUTH DEL EXISTS EXPIRE EXPIREAT HDEL HEXISTS HMSET MOVE MSETNX '
'PERSIST RENAMENX SISMEMBER SMOVE SETEX SETNX SREM ZREM',
'PERSIST RENAMENX SISMEMBER SMOVE SETEX SETNX ZREM',
bool
),
string_keys_to_dict(
'BITCOUNT DECRBY GETBIT HLEN INCRBY LINSERT LLEN LPUSHX RPUSHX '
'SADD SCARD SDIFFSTORE SETBIT SETRANGE SINTERSTORE STRLEN '
'SADD SCARD SDIFFSTORE SETBIT SETRANGE SINTERSTORE SREM STRLEN '
'SUNIONSTORE ZADD ZCARD ZREMRANGEBYRANK ZREMRANGEBYSCORE',
int
),
Expand Down
8 changes: 4 additions & 4 deletions tests/server_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,15 +942,15 @@ def test_srandmember(self):

def test_srem(self):
# key is not set
self.assertEquals(self.client.srem('a', 'a'), False)
self.assertEquals(self.client.srem('a', 'a'), 0)
# key is not a set
self.client['a'] = 'a'
self.assertRaises(redis.ResponseError, self.client.srem, 'a', 'a')
del self.client['a']
# real logic
self.make_set('a', 'abc')
self.assertEquals(self.client.srem('a', 'd'), False)
self.assertEquals(self.client.srem('a', 'b'), True)
self.make_set('a', 'abcd')
self.assertEquals(self.client.srem('a', 'e'), 0)
self.assertEquals(self.client.srem('a', 'b', 'd'), 2)
self.assertEquals(self.client.smembers('a'), set([b('a'), b('c')]))

def test_sunion(self):
Expand Down

0 comments on commit fcac7dd

Please sign in to comment.