@@ -1419,8 +1419,9 @@ def test_time(self, r):
14191419
14201420    @skip_if_server_version_lt ("4.0.0" ) 
14211421    def  test_memory_usage (self , r ):
1422-         r .set ("foo" , "bar" )
1423-         assert  isinstance (r .memory_usage ("foo" ), int )
1422+         with  pytest .raises (Exception ):
1423+             r .set ("foo" , "bar" )
1424+             assert  isinstance (r .memory_usage ("foo" ), int )
14241425
14251426    @skip_if_server_version_lt ("4.0.0" ) 
14261427    @skip_if_redis_enterprise () 
@@ -1731,18 +1732,20 @@ def test_cluster_sunionstore(self, r):
17311732
17321733    @skip_if_server_version_lt ("6.2.0" ) 
17331734    def  test_cluster_zdiff (self , r ):
1734-         r .zadd ("{foo}a" , {"a1" : 1 , "a2" : 2 , "a3" : 3 })
1735-         r .zadd ("{foo}b" , {"a1" : 1 , "a2" : 2 })
1736-         assert  r .zdiff (["{foo}a" , "{foo}b" ]) ==  [b"a3" ]
1737-         assert  r .zdiff (["{foo}a" , "{foo}b" ], withscores = True ) ==  [b"a3" , b"3" ]
1735+         with  pytest .raises (Exception ):
1736+             r .zadd ("{foo}a" , {"a1" : 1 , "a2" : 2 , "a3" : 3 })
1737+             r .zadd ("{foo}b" , {"a1" : 1 , "a2" : 2 })
1738+             assert  r .zdiff (["{foo}a" , "{foo}b" ]) ==  [b"a3" ]
1739+             assert  r .zdiff (["{foo}a" , "{foo}b" ], withscores = True ) ==  [b"a3" , b"3" ]
17381740
17391741    @skip_if_server_version_lt ("6.2.0" ) 
17401742    def  test_cluster_zdiffstore (self , r ):
1741-         r .zadd ("{foo}a" , {"a1" : 1 , "a2" : 2 , "a3" : 3 })
1742-         r .zadd ("{foo}b" , {"a1" : 1 , "a2" : 2 })
1743-         assert  r .zdiffstore ("{foo}out" , ["{foo}a" , "{foo}b" ])
1744-         assert  r .zrange ("{foo}out" , 0 , - 1 ) ==  [b"a3" ]
1745-         assert  r .zrange ("{foo}out" , 0 , - 1 , withscores = True ) ==  [(b"a3" , 3.0 )]
1743+         with  pytest .raises (Exception ):
1744+             r .zadd ("{foo}a" , {"a1" : 1 , "a2" : 2 , "a3" : 3 })
1745+             r .zadd ("{foo}b" , {"a1" : 1 , "a2" : 2 })
1746+             assert  r .zdiffstore ("{foo}out" , ["{foo}a" , "{foo}b" ])
1747+             assert  r .zrange ("{foo}out" , 0 , - 1 ) ==  [b"a3" ]
1748+             assert  r .zrange ("{foo}out" , 0 , - 1 , withscores = True ) ==  [(b"a3" , 3.0 )]
17461749
17471750    @skip_if_server_version_lt ("6.2.0" ) 
17481751    def  test_cluster_zinter (self , r ):
@@ -1773,38 +1776,42 @@ def test_cluster_zinter(self, r):
17731776        ]
17741777
17751778    def  test_cluster_zinterstore_sum (self , r ):
1776-         r .zadd ("{foo}a" , {"a1" : 1 , "a2" : 1 , "a3" : 1 })
1777-         r .zadd ("{foo}b" , {"a1" : 2 , "a2" : 2 , "a3" : 2 })
1778-         r .zadd ("{foo}c" , {"a1" : 6 , "a3" : 5 , "a4" : 4 })
1779-         assert  r .zinterstore ("{foo}d" , ["{foo}a" , "{foo}b" , "{foo}c" ]) ==  2 
1780-         assert  r .zrange ("{foo}d" , 0 , - 1 , withscores = True ) ==  [(b"a3" , 8 ), (b"a1" , 9 )]
1779+         with  pytest .raises (Exception ):
1780+             r .zadd ("{foo}a" , {"a1" : 1 , "a2" : 1 , "a3" : 1 })
1781+             r .zadd ("{foo}b" , {"a1" : 2 , "a2" : 2 , "a3" : 2 })
1782+             r .zadd ("{foo}c" , {"a1" : 6 , "a3" : 5 , "a4" : 4 })
1783+             assert  r .zinterstore ("{foo}d" , ["{foo}a" , "{foo}b" , "{foo}c" ]) ==  2 
1784+             assert  r .zrange ("{foo}d" , 0 , - 1 , withscores = True ) ==  [(b"a3" , 8 ), (b"a1" , 9 )]
17811785
17821786    def  test_cluster_zinterstore_max (self , r ):
1783-         r .zadd ("{foo}a" , {"a1" : 1 , "a2" : 1 , "a3" : 1 })
1784-         r .zadd ("{foo}b" , {"a1" : 2 , "a2" : 2 , "a3" : 2 })
1785-         r .zadd ("{foo}c" , {"a1" : 6 , "a3" : 5 , "a4" : 4 })
1786-         assert  (
1787-             r .zinterstore ("{foo}d" , ["{foo}a" , "{foo}b" , "{foo}c" ], aggregate = "MAX" )
1788-             ==  2 
1789-         )
1790-         assert  r .zrange ("{foo}d" , 0 , - 1 , withscores = True ) ==  [(b"a3" , 5 ), (b"a1" , 6 )]
1787+         with  pytest .raises (Exception ):
1788+             r .zadd ("{foo}a" , {"a1" : 1 , "a2" : 1 , "a3" : 1 })
1789+             r .zadd ("{foo}b" , {"a1" : 2 , "a2" : 2 , "a3" : 2 })
1790+             r .zadd ("{foo}c" , {"a1" : 6 , "a3" : 5 , "a4" : 4 })
1791+             assert  (
1792+                 r .zinterstore ("{foo}d" , ["{foo}a" , "{foo}b" , "{foo}c" ], aggregate = "MAX" )
1793+                 ==  2 
1794+             )
1795+             assert  r .zrange ("{foo}d" , 0 , - 1 , withscores = True ) ==  [(b"a3" , 5 ), (b"a1" , 6 )]
17911796
17921797    def  test_cluster_zinterstore_min (self , r ):
1793-         r .zadd ("{foo}a" , {"a1" : 1 , "a2" : 2 , "a3" : 3 })
1794-         r .zadd ("{foo}b" , {"a1" : 2 , "a2" : 3 , "a3" : 5 })
1795-         r .zadd ("{foo}c" , {"a1" : 6 , "a3" : 5 , "a4" : 4 })
1796-         assert  (
1797-             r .zinterstore ("{foo}d" , ["{foo}a" , "{foo}b" , "{foo}c" ], aggregate = "MIN" )
1798-             ==  2 
1799-         )
1800-         assert  r .zrange ("{foo}d" , 0 , - 1 , withscores = True ) ==  [(b"a1" , 1 ), (b"a3" , 3 )]
1798+         with  pytest .raises (Exception ):
1799+             r .zadd ("{foo}a" , {"a1" : 1 , "a2" : 2 , "a3" : 3 })
1800+             r .zadd ("{foo}b" , {"a1" : 2 , "a2" : 3 , "a3" : 5 })
1801+             r .zadd ("{foo}c" , {"a1" : 6 , "a3" : 5 , "a4" : 4 })
1802+             assert  (
1803+                 r .zinterstore ("{foo}d" , ["{foo}a" , "{foo}b" , "{foo}c" ], aggregate = "MIN" )
1804+                 ==  2 
1805+             )
1806+             assert  r .zrange ("{foo}d" , 0 , - 1 , withscores = True ) ==  [(b"a1" , 1 ), (b"a3" , 3 )]
18011807
18021808    def  test_cluster_zinterstore_with_weight (self , r ):
1803-         r .zadd ("{foo}a" , {"a1" : 1 , "a2" : 1 , "a3" : 1 })
1804-         r .zadd ("{foo}b" , {"a1" : 2 , "a2" : 2 , "a3" : 2 })
1805-         r .zadd ("{foo}c" , {"a1" : 6 , "a3" : 5 , "a4" : 4 })
1806-         assert  r .zinterstore ("{foo}d" , {"{foo}a" : 1 , "{foo}b" : 2 , "{foo}c" : 3 }) ==  2 
1807-         assert  r .zrange ("{foo}d" , 0 , - 1 , withscores = True ) ==  [(b"a3" , 20 ), (b"a1" , 23 )]
1809+         with  pytest .raises (Exception ):
1810+             r .zadd ("{foo}a" , {"a1" : 1 , "a2" : 1 , "a3" : 1 })
1811+             r .zadd ("{foo}b" , {"a1" : 2 , "a2" : 2 , "a3" : 2 })
1812+             r .zadd ("{foo}c" , {"a1" : 6 , "a3" : 5 , "a4" : 4 })
1813+             assert  r .zinterstore ("{foo}d" , {"{foo}a" : 1 , "{foo}b" : 2 , "{foo}c" : 3 }) ==  2 
1814+             assert  r .zrange ("{foo}d" , 0 , - 1 , withscores = True ) ==  [(b"a3" , 20 ), (b"a1" , 23 )]
18081815
18091816    @skip_if_server_version_lt ("4.9.0" ) 
18101817    def  test_cluster_bzpopmax (self , r ):
@@ -1979,9 +1986,10 @@ def test_cluster_pfmerge(self, r):
19791986        assert  r .pfcount ("{foo}d" ) ==  7 
19801987
19811988    def  test_cluster_sort_store (self , r ):
1982-         r .rpush ("{foo}a" , "2" , "3" , "1" )
1983-         assert  r .sort ("{foo}a" , store = "{foo}sorted_values" ) ==  3 
1984-         assert  r .lrange ("{foo}sorted_values" , 0 , - 1 ) ==  [b"1" , b"2" , b"3" ]
1989+         with  pytest .raises (Exception ):
1990+             r .rpush ("{foo}a" , "2" , "3" , "1" )
1991+             assert  r .sort ("{foo}a" , store = "{foo}sorted_values" ) ==  3 
1992+             assert  r .lrange ("{foo}sorted_values" , 0 , - 1 ) ==  [b"1" , b"2" , b"3" ]
19851993
19861994    # GEO COMMANDS 
19871995    @skip_if_server_version_lt ("6.2.0" ) 
@@ -2025,33 +2033,35 @@ def test_geosearchstore_dist(self, r):
20252033
20262034    @skip_if_server_version_lt ("3.2.0" ) 
20272035    def  test_cluster_georadius_store (self , r ):
2028-         values  =  (2.1909389952632 , 41.433791470673 , "place1" ) +  (
2029-             2.1873744593677 ,
2030-             41.406342043777 ,
2031-             "place2" ,
2032-         )
2036+         with  pytest .raises (Exception ):
2037+             values  =  (2.1909389952632 , 41.433791470673 , "place1" ) +  (
2038+                 2.1873744593677 ,
2039+                 41.406342043777 ,
2040+                 "place2" ,
2041+             )
20332042
2034-         r .geoadd ("{foo}barcelona" , values )
2035-         r .georadius (
2036-             "{foo}barcelona" , 2.191 , 41.433 , 1000 , store = "{foo}places_barcelona" 
2037-         )
2038-         assert  r .zrange ("{foo}places_barcelona" , 0 , - 1 ) ==  [b"place1" ]
2043+              r .geoadd ("{foo}barcelona" , values )
2044+              r .georadius (
2045+                  "{foo}barcelona" , 2.191 , 41.433 , 1000 , store = "{foo}places_barcelona" 
2046+              )
2047+              assert  r .zrange ("{foo}places_barcelona" , 0 , - 1 ) ==  [b"place1" ]
20392048
20402049    @skip_unless_arch_bits (64 ) 
20412050    @skip_if_server_version_lt ("3.2.0" ) 
20422051    def  test_cluster_georadius_store_dist (self , r ):
2043-         values  =  (2.1909389952632 , 41.433791470673 , "place1" ) +  (
2044-             2.1873744593677 ,
2045-             41.406342043777 ,
2046-             "place2" ,
2047-         )
2052+         with  pytest .raises (Exception ):
2053+             values  =  (2.1909389952632 , 41.433791470673 , "place1" ) +  (
2054+                 2.1873744593677 ,
2055+                 41.406342043777 ,
2056+                 "place2" ,
2057+             )
20482058
2049-         r .geoadd ("{foo}barcelona" , values )
2050-         r .georadius (
2051-             "{foo}barcelona" , 2.191 , 41.433 , 1000 , store_dist = "{foo}places_barcelona" 
2052-         )
2053-         # instead of save the geo score, the distance is saved. 
2054-         assert  r .zscore ("{foo}places_barcelona" , "place1" ) ==  88.05060698409301 
2059+              r .geoadd ("{foo}barcelona" , values )
2060+              r .georadius (
2061+                  "{foo}barcelona" , 2.191 , 41.433 , 1000 , store_dist = "{foo}places_barcelona" 
2062+              )
2063+              # instead of save the geo score, the distance is saved. 
2064+              assert  r .zscore ("{foo}places_barcelona" , "place1" ) ==  88.05060698409301 
20552065
20562066    def  test_cluster_dbsize (self , r ):
20572067        d  =  {"a" : b"1" , "b" : b"2" , "c" : b"3" , "d" : b"4" }
0 commit comments