summaryrefslogtreecommitdiff
path: root/tests/server_commands.py
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2010-05-23 07:39:44 -0700
committerAndy McCurdy <andy@andymccurdy.com>2010-05-23 07:39:44 -0700
commitdd8421273d4b17adfda56e8b753bdf92d4d43fb5 (patch)
tree3c0517172f1ecf62dedb4df671a5b4e16f66a5a9 /tests/server_commands.py
parent2b07bd7ad65d4fdee11e1a3dba65180dd920cf75 (diff)
downloadredis-py-dd8421273d4b17adfda56e8b753bdf92d4d43fb5.tar.gz
renamed zinter/zunion to zinterstore/zunionstore to stay consistent with Redis.
Diffstat (limited to 'tests/server_commands.py')
-rw-r--r--tests/server_commands.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/server_commands.py b/tests/server_commands.py
index 056188a..9024762 100644
--- a/tests/server_commands.py
+++ b/tests/server_commands.py
@@ -621,27 +621,29 @@ class ServerCommandsTestCase(unittest.TestCase):
self.assertEquals(self.client.zscore('a', 'a2'), 3.0)
self.assertEquals(self.client.zscore('a', 'a3'), 8.0)
- def test_zinter(self):
+ def test_zinterstore(self):
self.make_zset('a', {'a1': 1, 'a2': 1, 'a3': 1})
self.make_zset('b', {'a1': 2, 'a3': 2, 'a4': 2})
self.make_zset('c', {'a1': 6, 'a3': 5, 'a4': 4})
# sum, no weight
- self.assert_(self.client.zinter('z', ['a', 'b', 'c']))
+ self.assert_(self.client.zinterstore('z', ['a', 'b', 'c']))
self.assertEquals(
self.client.zrange('z', 0, -1, withscores=True),
[('a3', 8), ('a1', 9)]
)
# max, no weight
- self.assert_(self.client.zinter('z', ['a', 'b', 'c'], aggregate='MAX'))
+ self.assert_(
+ self.client.zinterstore('z', ['a', 'b', 'c'], aggregate='MAX')
+ )
self.assertEquals(
self.client.zrange('z', 0, -1, withscores=True),
[('a3', 5), ('a1', 6)]
)
# with weight
- self.assert_(self.client.zinter('z', {'a': 1, 'b': 2, 'c': 3}))
+ self.assert_(self.client.zinterstore('z', {'a': 1, 'b': 2, 'c': 3}))
self.assertEquals(
self.client.zrange('z', 0, -1, withscores=True),
[('a3', 20), ('a1', 23)]
@@ -764,27 +766,29 @@ class ServerCommandsTestCase(unittest.TestCase):
# test a non-existant member
self.assertEquals(self.client.zscore('a', 'a4'), None)
- def test_zunion(self):
+ def test_zunionstore(self):
self.make_zset('a', {'a1': 1, 'a2': 1, 'a3': 1})
self.make_zset('b', {'a1': 2, 'a3': 2, 'a4': 2})
self.make_zset('c', {'a1': 6, 'a4': 5, 'a5': 4})
# sum, no weight
- self.assert_(self.client.zunion('z', ['a', 'b', 'c']))
+ self.assert_(self.client.zunionstore('z', ['a', 'b', 'c']))
self.assertEquals(
self.client.zrange('z', 0, -1, withscores=True),
[('a2', 1), ('a3', 3), ('a5', 4), ('a4', 7), ('a1', 9)]
)
# max, no weight
- self.assert_(self.client.zunion('z', ['a', 'b', 'c'], aggregate='MAX'))
+ self.assert_(
+ self.client.zunionstore('z', ['a', 'b', 'c'], aggregate='MAX')
+ )
self.assertEquals(
self.client.zrange('z', 0, -1, withscores=True),
[('a2', 1), ('a3', 2), ('a5', 4), ('a4', 5), ('a1', 6)]
)
# with weight
- self.assert_(self.client.zunion('z', {'a': 1, 'b': 2, 'c': 3}))
+ self.assert_(self.client.zunionstore('z', {'a': 1, 'b': 2, 'c': 3}))
self.assertEquals(
self.client.zrange('z', 0, -1, withscores=True),
[('a2', 1), ('a3', 5), ('a5', 12), ('a4', 19), ('a1', 23)]