Skip to content

Commit

Permalink
smembers returns a list, not a set.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Sep 17, 2024
1 parent 7b838bb commit 5547700
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions tests/test_asyncio/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,7 @@ async def test_sdiffstore(self, r: valkey.asyncio.Valkey[bytes]):
assert set(await r.smembers("c")) == {b"1", b"2", b"3"}
await r.sadd("b", "2", "3")
assert await r.sdiffstore("c", "a", "b") == 1
assert await r.smembers("c") == {b"1", }
assert await r.smembers("c") == [b"1", ]

@pytest.mark.onlynoncluster
async def test_sinter(self, r: valkey.asyncio.Valkey[bytes]):
Expand All @@ -1447,7 +1447,7 @@ async def test_sinter(self, r: valkey.asyncio.Valkey[bytes]):
async def test_sinterstore(self, r: valkey.asyncio.Valkey[bytes]):
await r.sadd("a", "1", "2", "3")
assert await r.sinterstore("c", "a", "b") == 0
assert await r.smembers("c") == set()
assert await r.smembers("c") == list()
await r.sadd("b", "2", "3")
assert await r.sinterstore("c", "a", "b") == 2
assert set(await r.smembers("c")) == {b"2", b"3"}
Expand All @@ -1468,7 +1468,7 @@ async def test_smove(self, r: valkey.asyncio.Valkey[bytes]):
await r.sadd("a", "a1", "a2")
await r.sadd("b", "b1", "b2")
assert await r.smove("a", "b", "a1")
assert await r.smembers("a") == {b"a2", }
assert await r.smembers("a") == [b"a2", ]
assert set(await r.smembers("b")) == {b"b1", b"b2", b"a1"}

async def test_spop(self, r: valkey.asyncio.Valkey[bytes]):
Expand Down
4 changes: 2 additions & 2 deletions valkey/commands/core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ class SetCommands(Generic[_StrType]):
def sinter(self, keys: _Key | Iterable[_Key], *args: _Key) -> builtins.set[_Value]: ...
def sinterstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ...
def sismember(self, name: _Key, value: _Value) -> bool: ...
def smembers(self, name: _Key) -> builtins.set[_StrType]: ...
def smembers(self, name: _Key) -> builtins.list[_StrType]: ...
def smismember(self, name, values, *args): ...
def smove(self, src: _Key, dst: _Key, value: _Value) -> bool: ...
@overload
Expand All @@ -864,7 +864,7 @@ class AsyncSetCommands(Generic[_StrType]):
async def sinter(self, keys: _Key | Iterable[_Key], *args: _Key) -> builtins.set[_Value]: ...
async def sinterstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ...
async def sismember(self, name: _Key, value: _Value) -> bool: ...
async def smembers(self, name: _Key) -> builtins.set[_StrType]: ...
async def smembers(self, name: _Key) -> builtins.list[_StrType]: ...
async def smismember(self, name, values, *args): ...
async def smove(self, src: _Key, dst: _Key, value: _Value) -> bool: ...
@overload
Expand Down

0 comments on commit 5547700

Please sign in to comment.