@@ -743,34 +743,17 @@ def mock_time_sleep(monkeypatch):
743743
744744def mock_client ():
745745 mock_client = mock_strict_redis_client ()
746-
747- # Adding a couple of methods we use that mockredis doesn't support yet.
748- def scan_iter_patch (match = None , count = 100 ):
749- match = str (match ).replace ("*" , "" )
750- return [k for k in mock_client .keys () if k .startswith (match )]
751-
752- mock_client .scan_iter = scan_iter_patch
753746 mock_client .reset = lambda : True
754747
755- def zscan_iter_patch (key , match = None ):
756- match = str (match ).replace ("*" , "" )
757- return [
758- k for k in mock_client .zrange (key , 0 , - 1 ) if k .startswith (match )
759- ]
760-
761- mock_client .zscan_iter = zscan_iter_patch
748+ _zadd_orig = mock_client .zadd
762749
763750 def zadd_patch (key , mapping ):
764751 # as of pyredis 3.0, Redis.zadd takes a mapping of {member: score} instead of
765752 # the old Redis.zadd method that takes *args of score, member, score,
766753 # member or a kwarg mapping of {member: score}
767- return mock_client .zadd_orig (
768- key , ** {str (k ): v for k , v in mapping .items ()}
769- )
754+ return _zadd_orig (key , ** {str (k ): v for k , v in mapping .items ()})
770755
771- mock_client .zadd_orig = mock_client .zadd
772756 mock_client .zadd = zadd_patch
773-
774757 return mock_client
775758
776759
0 commit comments