Skip to content

Commit

Permalink
test hincrbyfloat
Browse files Browse the repository at this point in the history
  • Loading branch information
amirreza8002 committed Dec 17, 2024
1 parent ea5fd51 commit f61f3f9
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 @@ -938,6 +938,16 @@ def test_hincrby(self, cache: ValkeyCache):
assert cache.hget("foo_hash1", "foo1") == 3
assert result == 3

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

cache.hset("foo_hash1", "foo1", 1.0)
assert cache.hget("foo_hash1", "foo1") == 1.0
result = cache.hincrbyfloat("foo_hash1", "foo1", amount=2.2)
assert cache.hget("foo_hash1", "foo1") == 3.2
assert result == 3.2

def test_hlen(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 @@ -942,6 +942,13 @@ async def test_hincrby(self, cache: AsyncValkeyCache):
assert await cache.ahget("foo_hash1", "foo1") == 3
assert result == 3

async def test_hincrbyfloat(self, cache: AsyncValkeyCache):
await cache.ahset("foo_hash1", "foo1", 1.0)
assert await cache.ahget("foo_hash1", "foo1") == 1.0
result = await cache.ahincrbyfloat("foo_hash1", "foo1", amount=2.2)
assert await cache.ahget("foo_hash1", "foo1") == 3.2
assert result == 3.2

async def test_hlen(self, cache: AsyncValkeyCache):
# if isinstance(cache.client, ShardClient):
# pytest.skip("ShardClient doesn't support get_client")
Expand Down

0 comments on commit f61f3f9

Please sign in to comment.