@@ -3026,38 +3026,37 @@ def test_sort_store(self, r):
30263026
30273027 @pytest .mark .onlynoncluster
30283028 def test_sort_all_options (self , r ):
3029- with pytest .raises (Exception ):
3030- r ["user:1:username" ] = "zeus"
3031- r ["user:2:username" ] = "titan"
3032- r ["user:3:username" ] = "hermes"
3033- r ["user:4:username" ] = "hercules"
3034- r ["user:5:username" ] = "apollo"
3035- r ["user:6:username" ] = "athena"
3036- r ["user:7:username" ] = "hades"
3037- r ["user:8:username" ] = "dionysus"
3038-
3039- r ["user:1:favorite_drink" ] = "yuengling"
3040- r ["user:2:favorite_drink" ] = "rum"
3041- r ["user:3:favorite_drink" ] = "vodka"
3042- r ["user:4:favorite_drink" ] = "milk"
3043- r ["user:5:favorite_drink" ] = "pinot noir"
3044- r ["user:6:favorite_drink" ] = "water"
3045- r ["user:7:favorite_drink" ] = "gin"
3046- r ["user:8:favorite_drink" ] = "apple juice"
3047-
3048- r .rpush ("gods" , "5" , "8" , "3" , "1" , "2" , "7" , "6" , "4" )
3049- num = r .sort (
3050- "gods" ,
3051- start = 2 ,
3052- num = 4 ,
3053- by = "user:*:username" ,
3054- get = "user:*:favorite_drink" ,
3055- desc = True ,
3056- alpha = True ,
3057- store = "sorted" ,
3058- )
3059- assert num == 4
3060- assert r .lrange ("sorted" , 0 , 10 ) == [b"vodka" , b"milk" , b"gin" , b"apple juice" ]
3029+ r ["user:1:username" ] = "zeus"
3030+ r ["user:2:username" ] = "titan"
3031+ r ["user:3:username" ] = "hermes"
3032+ r ["user:4:username" ] = "hercules"
3033+ r ["user:5:username" ] = "apollo"
3034+ r ["user:6:username" ] = "athena"
3035+ r ["user:7:username" ] = "hades"
3036+ r ["user:8:username" ] = "dionysus"
3037+
3038+ r ["user:1:favorite_drink" ] = "yuengling"
3039+ r ["user:2:favorite_drink" ] = "rum"
3040+ r ["user:3:favorite_drink" ] = "vodka"
3041+ r ["user:4:favorite_drink" ] = "milk"
3042+ r ["user:5:favorite_drink" ] = "pinot noir"
3043+ r ["user:6:favorite_drink" ] = "water"
3044+ r ["user:7:favorite_drink" ] = "gin"
3045+ r ["user:8:favorite_drink" ] = "apple juice"
3046+
3047+ r .rpush ("gods" , "5" , "8" , "3" , "1" , "2" , "7" , "6" , "4" )
3048+ num = r .sort (
3049+ "gods" ,
3050+ start = 2 ,
3051+ num = 4 ,
3052+ by = "user:*:username" ,
3053+ get = "user:*:favorite_drink" ,
3054+ desc = True ,
3055+ alpha = True ,
3056+ store = "sorted" ,
3057+ )
3058+ assert num == 4
3059+ assert r .lrange ("sorted" , 0 , 10 ) == [b"vodka" , b"milk" , b"gin" , b"apple juice" ]
30613060
30623061 @skip_if_server_version_lt ("7.0.0" )
30633062 @pytest .mark .onlynoncluster
@@ -3604,7 +3603,11 @@ def test_georadius_with(self, r):
36043603 assert r .georadius (
36053604 "barcelona" , 2.191 , 41.433 , 1 , unit = "km" , withhash = True , withcoord = True
36063605 ) == [
3607- [b"place1" , 3471609698139488 , (2.19093829393386841 , 41.43379028184083523 )]
3606+ [
3607+ b"place1" ,
3608+ 3471609698139488 ,
3609+ (2.19093829393386841 , 41.43379028184083523 ),
3610+ ]
36083611 ]
36093612
36103613 # test no values.
@@ -3704,7 +3707,12 @@ def test_georadiusmember(self, r):
37043707 assert r .georadiusbymember ("barcelona" , "place1" , 10 ) == [b"place1" ]
37053708
37063709 assert r .georadiusbymember (
3707- "barcelona" , "place1" , 4000 , withdist = True , withcoord = True , withhash = True
3710+ "barcelona" ,
3711+ "place1" ,
3712+ 4000 ,
3713+ withdist = True ,
3714+ withcoord = True ,
3715+ withhash = True ,
37083716 ) == [
37093717 [
37103718 b"\x80 place2" ,
@@ -3729,9 +3737,9 @@ def test_georadiusmember_count(self, r):
37293737 b"\x80 place2" ,
37303738 )
37313739 r .geoadd ("barcelona" , values )
3732- assert r .georadiusbymember ("barcelona" , "place1" , 4000 , count = 1 , any = True ) == [
3733- b" \x80 place2"
3734- ]
3740+ assert r .georadiusbymember (
3741+ "barcelona" , "place1" , 4000 , count = 1 , any = True
3742+ ) == [ b" \x80 place2" ]
37353743
37363744 @skip_if_server_version_lt ("5.0.0" )
37373745 def test_xack (self , r ):
@@ -3863,7 +3871,12 @@ def test_xautoclaim(self, r):
38633871 stream , group , consumer1 , min_idle_time = 0 , start_id = 0 , justid = True
38643872 ) == [message_id1 , message_id2 ]
38653873 assert r .xautoclaim (
3866- stream , group , consumer1 , min_idle_time = 0 , start_id = message_id2 , justid = True
3874+ stream ,
3875+ group ,
3876+ consumer1 ,
3877+ min_idle_time = 0 ,
3878+ start_id = message_id2 ,
3879+ justid = True ,
38673880 ) == [message_id2 ]
38683881
38693882 @skip_if_server_version_lt ("6.2.0" )
@@ -4234,7 +4247,9 @@ def test_xpending_range_idle(self, r):
42344247
42354248 response = r .xpending_range (stream , group , min = "-" , max = "+" , count = 5 )
42364249 assert len (response ) == 2
4237- response = r .xpending_range (stream , group , min = "-" , max = "+" , count = 5 , idle = 1000 )
4250+ response = r .xpending_range (
4251+ stream , group , min = "-" , max = "+" , count = 5 , idle = 1000
4252+ )
42384253 assert len (response ) == 0
42394254
42404255 def test_xpending_range_negative (self , r ):
@@ -4292,7 +4307,10 @@ def test_xread(self, r):
42924307 expected = [
42934308 [
42944309 stream .encode (),
4295- [get_stream_message (r , stream , m1 ), get_stream_message (r , stream , m2 )],
4310+ [
4311+ get_stream_message (r , stream , m1 ),
4312+ get_stream_message (r , stream , m2 ),
4313+ ],
42964314 ]
42974315 ]
42984316 # xread starting at 0 returns both messages
@@ -4322,7 +4340,10 @@ def test_xreadgroup(self, r):
43224340 expected = [
43234341 [
43244342 stream .encode (),
4325- [get_stream_message (r , stream , m1 ), get_stream_message (r , stream , m2 )],
4343+ [
4344+ get_stream_message (r , stream , m1 ),
4345+ get_stream_message (r , stream , m2 ),
4346+ ],
43264347 ]
43274348 ]
43284349 # xread starting at 0 returns both messages
@@ -4333,7 +4354,10 @@ def test_xreadgroup(self, r):
43334354
43344355 expected = [[stream .encode (), [get_stream_message (r , stream , m1 )]]]
43354356 # xread with count=1 returns only the first message
4336- assert r .xreadgroup (group , consumer , streams = {stream : ">" }, count = 1 ) == expected
4357+ assert (
4358+ r .xreadgroup (group , consumer , streams = {stream : ">" }, count = 1 )
4359+ == expected
4360+ )
43374361
43384362 r .xgroup_destroy (stream , group )
43394363
@@ -4349,7 +4373,11 @@ def test_xreadgroup(self, r):
43494373 r .xgroup_destroy (stream , group )
43504374 r .xgroup_create (stream , group , "0" )
43514375 assert (
4352- len (r .xreadgroup (group , consumer , streams = {stream : ">" }, noack = True )[0 ][1 ])
4376+ len (
4377+ r .xreadgroup (group , consumer , streams = {stream : ">" }, noack = True )[0 ][
4378+ 1
4379+ ]
4380+ )
43534381 == 2
43544382 )
43554383 # now there should be nothing pending
0 commit comments