mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
fix(redis): make xadd fields use SupportsItems (#10780)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
16
stubs/redis/@tests/test_cases/check_xadd.py
Normal file
16
stubs/redis/@tests/test_cases/check_xadd.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from typing import TypedDict
|
||||
|
||||
import redis
|
||||
|
||||
|
||||
class RedisStreamData(TypedDict):
|
||||
foo: str
|
||||
bar: bytes
|
||||
|
||||
|
||||
def check_xadd(r: redis.Redis[str]) -> None:
|
||||
# check that TypedDicts are accepted for the `fields` parameter of `xadd()`
|
||||
#
|
||||
# N.B. the `pyright: ignore` is not part of the test,
|
||||
# it's just because the return type is currently unannotated
|
||||
r.xadd("stream", fields=RedisStreamData({"foo": "bar", "bar": b"foo"})) # pyright: ignore[reportUnknownMemberType]
|
||||
Reference in New Issue
Block a user