Skip to content

Commit

Permalink
test hmget
Browse files Browse the repository at this point in the history
  • Loading branch information
amirreza8002 committed Dec 14, 2024
1 parent 793657a commit 2155d86
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,16 @@ def test_hgetall(self, cache: ValkeyCache):
result = cache.hgetall("foo_hash2")
assert result == {}

def test_hmget(self, cache: ValkeyCache):
if isinstance(cache.client, ShardClient):
pytest.skip("ShardClient doesn't support get_client")

cache.hset("hash1", "foo1", "bar1")
cache.hset("hash1", "foo2", "bar2")

result = cache.hmget("hash1", ["foo1", "foo2"])
assert result == ["bar1", "bar2"]

def test_hincrby(self, cache: ValkeyCache):
if isinstance(cache.client, ShardClient):
pytest.skip("ShardClient doesn't support get_client")
Expand Down
7 changes: 7 additions & 0 deletions tests/tests_async/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,13 @@ async def test_hgetall(self, cache: AsyncValkeyCache):
result = await cache.ahgetall("foo_hash2")
assert result == {}

async def test_hmget(self, cache: AsyncValkeyCache):
await cache.ahset("hash1", "foo1", "bar1")
await cache.ahset("hash1", "foo2", "bar2")

result = await cache.ahmget("hash1", ["foo1", "foo2"])
assert result == ["bar1", "bar2"]

async def test_hincrby(self, cache: AsyncValkeyCache):
await cache.ahset("foo_hash1", "foo1", 1)
assert await cache.ahget("foo_hash1", "foo1") == 1
Expand Down

0 comments on commit 2155d86

Please sign in to comment.