-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add expire, exists, delete, eval, z* and pf* (#33)
- Loading branch information
Showing
8 changed files
with
322 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from uuid import uuid4 | ||
|
||
import redis_rs | ||
|
||
|
||
async def test_exists(async_client: redis_rs.AsyncClient): | ||
key = str(uuid4()) | ||
await async_client.set(key, 1) | ||
|
||
result = await async_client.exists(key) | ||
assert result == 1 | ||
|
||
|
||
async def test_delete(async_client: redis_rs.AsyncClient): | ||
key = str(uuid4()) | ||
await async_client.set(key, 1) | ||
|
||
result = await async_client.delete(key) | ||
assert result == 1 | ||
|
||
|
||
async def test_expire(async_client: redis_rs.AsyncClient): | ||
key = str(uuid4()) | ||
await async_client.set(key, 1) | ||
|
||
result = await async_client.expire(key, 2) | ||
assert result is True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from uuid import uuid4 | ||
|
||
import redis_rs | ||
|
||
|
||
async def test_pfadd(async_client: redis_rs.AsyncClient): | ||
key = str(uuid4()) | ||
|
||
result = await async_client.pfadd(key, 2) | ||
assert result is True | ||
|
||
|
||
async def test_pfcount(async_client: redis_rs.AsyncClient): | ||
key = str(uuid4()) | ||
|
||
b = await async_client.pfadd(key, 2) | ||
assert b is True | ||
|
||
result = await async_client.pfcount(key) | ||
assert result == 1 | ||
|
||
|
||
async def test_pfmerge(async_client: redis_rs.AsyncClient): | ||
key1 = str(uuid4()) | ||
key2 = str(uuid4()) | ||
|
||
b = await async_client.pfadd(key1, 2) | ||
assert b is True | ||
|
||
b = await async_client.pfmerge(key2, key1) | ||
assert b is True | ||
|
||
result = await async_client.pfcount(key2) | ||
assert result == 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import redis_rs | ||
|
||
|
||
async def test_return(async_client: redis_rs.AsyncClient): | ||
result = await async_client.eval("return ARGV[1]", 0, "a", encoding="utf-8") | ||
assert result == "a" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.