Closed GTVanitha closed 1 year ago
Can you provide the full code creating this error? I created this test to check and everything seems to pass:
async def test_type(req_aioredis2: redis.asyncio.Redis):
r = req_aioredis2
await r.set('string_key', "value")
await r.lpush("list_key", "value")
await r.sadd("set_key", "value")
await r.zadd("zset_key", {"value": 1})
await r.hset('hset_key', 'key', 'value')
assert b'string' == await r.type('string_key') # noqa: E721
assert b'list' == await r.type('list_key') # noqa: E721
assert b'set' == await r.type('set_key') # noqa: E721
assert b'zset' == await r.type('zset_key') # noqa: E721
assert b'hash' == await r.type('hset_key') # noqa: E721
assert b'none' == await r.type('none_key') # noqa: E721
Closing due to no response.
Apologies for the delayed response. I'm currently storing data in a Redis stream, and before processing the data within the stream, I'm checking whether the key's data type is of the 'stream' type.
According to the Redis official documentation, the 'TYPE' command supports data types such as string, list, set, zset, hash, and stream. However, it appears that fakeredis does not support the 'stream' data type, leading to the reported error.
Additionally, in the mentioned test case, there is no check for the 'stream' data type.
This has been fixed in the latest version: https://github.com/cunla/fakeredis-py/releases/tag/v2.18.1
Thank you
Code
key_type = await redis_client.type(key)
Error
Env