Permalink
Browse files

fix smove command

  • Loading branch information...
1 parent 02bdbb2 commit cfcd77fc504d85433ea3d3e6b83ef715b8da0e7e @salimane committed Nov 19, 2012
Showing with 5 additions and 8 deletions.
  1. +1 −1 rediscluster/__init__.py
  2. +3 −1 rediscluster/cluster_client.py
  3. +1 −6 tests/cluster_commands.py
View
@@ -11,7 +11,7 @@
from rediscluster.cluster_client import StrictRedisCluster
-__version__ = '0.3.0'
+__version__ = '0.3.1'
VERSION = tuple(map(int, __version__.split('.')))
__all__ = [
@@ -324,6 +324,8 @@ def _rc_smove(self, src, dst, value):
Move ``value`` from set ``src`` to set ``dst``
not atomic
"""
+ if self.type(dst) != "set":
+ return self.smove(src + "{" + src + "}", dst, value)
if self.srem(src, value):
return bool(self.sadd(dst, value))
return False
@@ -414,7 +416,7 @@ def _rc_rename(self, src, dst):
# Handle keys with an expire time set
kttl = -1 if kttl is None or kttl < 0 else int(kttl)
if kttl != -1:
- dst.expire(dst, kttl)
+ self.expire(dst, kttl)
return self.delete(src)
@@ -970,14 +970,9 @@ def test_smembers(self):
set([b('a'), b('b'), b('c')]))
def test_smove(self):
- # CLUSTER
- try:
- raise unittest.SkipTest()
- except AttributeError:
- return
# src key is not set
self.make_set('b', ['b1', 'b2'])
- self.assertEquals(self.client.smove('a', 'b', 'a1'), 0)
+ self.assertEquals(self.client.smove('a', 'b', 'a1'), False)
# src key is not a set
self.client['a'] = 'a'
self.assertRaises(

0 comments on commit cfcd77f

Please sign in to comment.