@@ -2006,10 +2006,30 @@ def test_cluster_zunion(self, r):
20062006 ]
20072007
20082008 def test_cluster_zunionstore_sum (self , r ):
2009+ assert r .zunionstore ("{foo}d" , ["{foo}" + str (i ) for i in range (0 , 256 )]) == 0
2010+
20092011 r .zadd ("{foo}a" , {"a1" : 1 , "a2" : 1 , "a3" : 1 })
20102012 r .zadd ("{foo}b" , {"a1" : 2 , "a2" : 2 , "a3" : 2 })
20112013 r .zadd ("{foo}c" , {"a1" : 6 , "a3" : 5 , "a4" : 4 })
2014+
2015+ result_key = "{foo}d"
2016+ failed_keys = ["{foo1}a" , "{foo}b" , "{foo}c" ]
2017+ with pytest .raises (
2018+ RedisClusterException ,
2019+ match = "ZUNIONSTORE - all keys must map to the same key slot" ,
2020+ ):
2021+ r .zunionstore (result_key , failed_keys )
2022+
2023+ result_key = "{foo1}d"
2024+ failed_keys = ["{foo}a" , "{foo}b" ]
2025+ with pytest .raises (
2026+ RedisClusterException ,
2027+ match = "ZUNIONSTORE - all keys must map to the same key slot" ,
2028+ ):
2029+ r .zunionstore (result_key , failed_keys )
2030+
20122031 assert r .zunionstore ("{foo}d" , ["{foo}a" , "{foo}b" , "{foo}c" ]) == 4
2032+ assert r .zunionstore ("{foo}e" , ["{foo}a" ]) == 3
20132033 assert r .zrange ("{foo}d" , 0 , - 1 , withscores = True ) == [
20142034 (b"a2" , 3 ),
20152035 (b"a4" , 4 ),
0 commit comments