topk().list decodes "infinity" as float · Issue #3573 · redis/redis-py (original) (raw)
Version: 5.2.1
Platform: Python 3.13.2
Expected behavior
Calling topk().list()
on a topk structure containing the string "infinity" should include the string "infinity" in the results.
>>> import redis as r
>>> redis = r.Redis()
>>> redis.topk().reserve("foo", 10, 20, 20, 0.9)
True
>>> redis.topk().add("foo", "infinity")
[None]
>>> redis.topk().list("foo")
["infinity"]
>>> type(redis.topk().list("foo")[0])
<class 'str'>
Actual behavior
The string "infinity" gets decoded as an inf
float value.
>>> import redis as r
>>> redis = r.Redis()
>>> redis.topk().reserve("foo", 10, 20, 20, 0.9)
True
>>> redis.topk().add("foo", "infinity")
[None]
>>> redis.topk().list("foo")
[inf]
>>> type(redis.topk().list("foo")[0])
<class 'float'>