scan_iter() with type filter asserts when there is a stream key
mjessome opened this issue · comments
Marc Jessome commented
Describe the bug
I'm on fakeredis-py 2.18.0
When a stream exists, and using scan_iter(_type='XXX')
, we hit the following assert:
key = <fakeredis._commands.Item object at 0x10feaad40>
def key_value_type(key):
if key.value is None:
return SimpleString(b'none')
elif isinstance(key.value, bytes):
return SimpleString(b'string')
elif isinstance(key.value, list):
return SimpleString(b'list')
elif isinstance(key.value, set):
return SimpleString(b'set')
elif isinstance(key.value, ZSet):
return SimpleString(b'zset')
elif isinstance(key.value, dict):
return SimpleString(b'hash')
else:
> assert False # pragma: nocover
E AssertionError
To Reproduce
from fakeredis import FakeRedis
r = FakeRedis()
r.xadd("mystream", { "test": "value" })
for s in r.scan_iter(_type="STRING"):
print(s)
Expected behavior
Doesn't assert, Stream keys are enumerated (or filtered out) just like any other key.
Desktop (please complete the following information):
- OS: MacOS 13.4.1
- python version: 3.10.8
- redis-py version: 4.3.6
Additional context
Thank you!