@@ -72,19 +72,19 @@ def test_get_from_given_cache(self, r, r2):
72
72
# get key from redis and save in local cache
73
73
assert r .get ("foo" ) in [b"bar" , "bar" ]
74
74
# get key from local cache
75
- assert (
76
- cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value
77
- in [ b "bar" , "bar" ]
78
- )
75
+ assert cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value in [
76
+ b"bar" ,
77
+ "bar" ,
78
+ ]
79
79
# change key in redis (cause invalidation)
80
80
r2 .set ("foo" , "barbar" )
81
81
# Retrieves a new value from server and cache it
82
82
assert r .get ("foo" ) in [b"barbar" , "barbar" ]
83
83
# Make sure that new value was cached
84
- assert (
85
- cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value
86
- in [ b "barbar" , "barbar" ]
87
- )
84
+ assert cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value in [
85
+ b"barbar" ,
86
+ "barbar" ,
87
+ ]
88
88
89
89
@pytest .mark .parametrize (
90
90
"r" ,
@@ -117,19 +117,19 @@ def test_get_from_default_cache(self, r, r2):
117
117
# get key from redis and save in local cache
118
118
assert r .get ("foo" ) in [b"bar" , "bar" ]
119
119
# get key from local cache
120
- assert (
121
- cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value
122
- in [ b "bar" , "bar" ]
123
- )
120
+ assert cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value in [
121
+ b"bar" ,
122
+ "bar" ,
123
+ ]
124
124
# change key in redis (cause invalidation)
125
125
r2 .set ("foo" , "barbar" )
126
126
# Retrieves a new value from server and cache it
127
127
assert r .get ("foo" ) in [b"barbar" , "barbar" ]
128
128
# Make sure that new value was cached
129
- assert (
130
- cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value
131
- in [ b "barbar" , "barbar" ]
132
- )
129
+ assert cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value in [
130
+ b"barbar" ,
131
+ "barbar" ,
132
+ ]
133
133
134
134
@pytest .mark .parametrize (
135
135
"r" ,
@@ -379,19 +379,19 @@ def test_get_from_cache(self, r):
379
379
# get key from redis and save in local cache
380
380
assert r .get ("foo" ) in [b"bar" , "bar" ]
381
381
# get key from local cache
382
- assert (
383
- cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value
384
- in [ b "bar" , "bar" ]
385
- )
382
+ assert cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value in [
383
+ b"bar" ,
384
+ "bar" ,
385
+ ]
386
386
# change key in redis (cause invalidation)
387
387
r .set ("foo" , "barbar" )
388
388
# Retrieves a new value from server and cache it
389
389
assert r .get ("foo" ) in [b"barbar" , "barbar" ]
390
390
# Make sure that new value was cached
391
- assert (
392
- cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value
393
- in [ b "barbar" , "barbar" ]
394
- )
391
+ assert cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value in [
392
+ b"barbar" ,
393
+ "barbar" ,
394
+ ]
395
395
# Make sure that cache is shared between nodes.
396
396
assert (
397
397
cache == r .nodes_manager .get_node_from_slot (1 ).redis_connection .get_cache ()
@@ -420,19 +420,19 @@ def test_get_from_custom_cache(self, r, r2):
420
420
# get key from redis and save in local cache
421
421
assert r .get ("foo" ) in [b"bar" , "bar" ]
422
422
# get key from local cache
423
- assert (
424
- cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value
425
- in [ b "bar" , "bar" ]
426
- )
423
+ assert cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value in [
424
+ b"bar" ,
425
+ "bar" ,
426
+ ]
427
427
# change key in redis (cause invalidation)
428
428
r2 .set ("foo" , "barbar" )
429
429
# Retrieves a new value from server and cache it
430
430
assert r .get ("foo" ) in [b"barbar" , "barbar" ]
431
431
# Make sure that new value was cached
432
- assert (
433
- cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value
434
- in [ b "barbar" , "barbar" ]
435
- )
432
+ assert cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value in [
433
+ b"barbar" ,
434
+ "barbar" ,
435
+ ]
436
436
437
437
@pytest .mark .parametrize (
438
438
"r" ,
@@ -640,7 +640,7 @@ class TestSentinelCache:
640
640
"cache" : DefaultCache (CacheConfig (max_size = 128 )),
641
641
"force_master_ip" : "localhost" ,
642
642
"decode_responses" : True ,
643
- }
643
+ },
644
644
],
645
645
indirect = True ,
646
646
)
@@ -651,19 +651,19 @@ def test_get_from_cache(self, master):
651
651
# get key from redis and save in local cache_data
652
652
assert master .get ("foo" ) in [b"bar" , "bar" ]
653
653
# get key from local cache_data
654
- assert (
655
- cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value
656
- in [ b "bar" , "bar" ]
657
- )
654
+ assert cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value in [
655
+ b"bar" ,
656
+ "bar" ,
657
+ ]
658
658
# change key in redis (cause invalidation)
659
659
master .set ("foo" , "barbar" )
660
660
# get key from redis
661
661
assert master .get ("foo" ) in [b"barbar" , "barbar" ]
662
662
# Make sure that new value was cached
663
- assert (
664
- cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value
665
- in [ b "barbar" , "barbar" ]
666
- )
663
+ assert cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value in [
664
+ b"barbar" ,
665
+ "barbar" ,
666
+ ]
667
667
668
668
@pytest .mark .parametrize (
669
669
"r" ,
@@ -687,19 +687,19 @@ def test_get_from_default_cache(self, r, r2):
687
687
# get key from redis and save in local cache_data
688
688
assert r .get ("foo" ) in [b"bar" , "bar" ]
689
689
# get key from local cache_data
690
- assert (
691
- cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value
692
- in [ b "bar" , "bar" ]
693
- )
690
+ assert cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value in [
691
+ b"bar" ,
692
+ "bar" ,
693
+ ]
694
694
# change key in redis (cause invalidation)
695
695
r2 .set ("foo" , "barbar" )
696
696
# Retrieves a new value from server and cache_data it
697
697
assert r .get ("foo" ) in [b"barbar" , "barbar" ]
698
698
# Make sure that new value was cached
699
- assert (
700
- cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value
701
- in [ b "barbar" , "barbar" ]
702
- )
699
+ assert cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value in [
700
+ b"barbar" ,
701
+ "barbar" ,
702
+ ]
703
703
704
704
@pytest .mark .parametrize (
705
705
"sentinel_setup" ,
@@ -760,7 +760,7 @@ def test_cache_clears_on_disconnect(self, master, cache):
760
760
761
761
@pytest .mark .skipif (HIREDIS_AVAILABLE , reason = "PythonParser only" )
762
762
@pytest .mark .onlynoncluster
763
- #@skip_if_resp_version(2)
763
+ # @skip_if_resp_version(2)
764
764
@skip_if_server_version_lt ("7.4.0" )
765
765
class TestSSLCache :
766
766
@pytest .mark .parametrize (
@@ -774,7 +774,7 @@ class TestSSLCache:
774
774
"cache" : DefaultCache (CacheConfig (max_size = 128 )),
775
775
"ssl" : True ,
776
776
"decode_responses" : True ,
777
- }
777
+ },
778
778
],
779
779
indirect = True ,
780
780
)
@@ -786,10 +786,10 @@ def test_get_from_cache(self, r, r2, cache):
786
786
# get key from redis and save in local cache_data
787
787
assert r .get ("foo" ) in [b"bar" , "bar" ]
788
788
# get key from local cache_data
789
- assert (
790
- cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value
791
- in [ b "bar" , "bar" ]
792
- )
789
+ assert cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value in [
790
+ b"bar" ,
791
+ "bar" ,
792
+ ]
793
793
# change key in redis (cause invalidation)
794
794
assert r2 .set ("foo" , "barbar" )
795
795
# Timeout needed for SSL connection because there's timeout
@@ -798,10 +798,10 @@ def test_get_from_cache(self, r, r2, cache):
798
798
# Retrieves a new value from server and cache_data it
799
799
assert r .get ("foo" ) in [b"barbar" , "barbar" ]
800
800
# Make sure that new value was cached
801
- assert (
802
- cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value
803
- in [ b "barbar" , "barbar" ]
804
- )
801
+ assert cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value in [
802
+ b"barbar" ,
803
+ "barbar" ,
804
+ ]
805
805
806
806
@pytest .mark .parametrize (
807
807
"r" ,
@@ -827,10 +827,10 @@ def test_get_from_custom_cache(self, r, r2):
827
827
# get key from redis and save in local cache_data
828
828
assert r .get ("foo" ) in [b"bar" , "bar" ]
829
829
# get key from local cache_data
830
- assert (
831
- cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value
832
- in [ b "bar" , "bar" ]
833
- )
830
+ assert cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value in [
831
+ b"bar" ,
832
+ "bar" ,
833
+ ]
834
834
# change key in redis (cause invalidation)
835
835
r2 .set ("foo" , "barbar" )
836
836
# Timeout needed for SSL connection because there's timeout
@@ -839,10 +839,10 @@ def test_get_from_custom_cache(self, r, r2):
839
839
# Retrieves a new value from server and cache_data it
840
840
assert r .get ("foo" ) in [b"barbar" , "barbar" ]
841
841
# Make sure that new value was cached
842
- assert (
843
- cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value
844
- in [ b "barbar" , "barbar" ]
845
- )
842
+ assert cache . get ( CacheKey ( command = "GET" , redis_keys = ( "foo" ,))). cache_value in [
843
+ b"barbar" ,
844
+ "barbar" ,
845
+ ]
846
846
847
847
@pytest .mark .parametrize (
848
848
"r" ,
0 commit comments