Skip to content

Commit d78c5d3

Browse files
committed
Updated test cases
1 parent c106873 commit d78c5d3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

redis/cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ class EvictionPolicyType(Enum):
1717

1818

1919
class CacheKey:
20-
def __init__(self, command: str, redis_keys: tuple[str, ...]):
20+
def __init__(self, command: str, redis_keys: tuple):
2121
self.command = command
2222
self.redis_keys = redis_keys
2323

24-
def get_redis_keys(self) -> tuple[str, ...]:
24+
def get_redis_keys(self) -> tuple:
2525
return self.redis_keys
2626

2727
def __hash__(self):

tests/test_connection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def test_throws_error_on_cache_enable_in_resp2(self):
381381

382382
def test_throws_error_on_incorrect_cache_implementation(self):
383383
with pytest.raises(ValueError, match="Cache must implement CacheInterface"):
384-
ConnectionPool(protocol=3, use_cache=True, cache=TTLCache(100, 20))
384+
ConnectionPool(protocol=3, use_cache=True, cache='wrong')
385385

386386
def test_returns_custom_cache_implementation(self, mock_cache):
387387
connection_pool = ConnectionPool(protocol=3, use_cache=True, cache=mock_cache)
@@ -423,7 +423,7 @@ def test_make_connection_proxy_connection_on_given_cache(self):
423423

424424
class TestUnitCacheProxyConnection:
425425
def test_clears_cache_on_disconnect(self, mock_connection, cache_conf):
426-
cache = DefaultCache(10, eviction_policy=LRUPolicy())
426+
cache = DefaultCache(CacheConfiguration(max_size=10))
427427
cache_key = CacheKey(command="GET", redis_keys=("foo",))
428428

429429
cache.set(
@@ -438,7 +438,7 @@ def test_clears_cache_on_disconnect(self, mock_connection, cache_conf):
438438
mock_connection.host = "mock"
439439
mock_connection.port = "mock"
440440

441-
proxy_connection = CacheProxyConnection(mock_connection, cache, cache_conf)
441+
proxy_connection = CacheProxyConnection(mock_connection, cache)
442442
proxy_connection.disconnect()
443443

444444
assert len(cache.get_collection()) == 0

0 commit comments

Comments
 (0)