diff options
-rw-r--r-- | redis/commands/core.py | 7 | ||||
-rw-r--r-- | tests/test_commands.py | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/redis/commands/core.py b/redis/commands/core.py index 0823315..4f0accd 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -780,6 +780,13 @@ class ManagementCommands: """ return self.execute_command("SWAPDB", first, second, **kwargs) + def select(self, index, **kwargs): + """Select the Redis logical database at index. + + See: https://redis.io/commands/select + """ + return self.execute_command("SELECT", index, **kwargs) + def info(self, section=None, **kwargs): """ Returns a dictionary containing information about the Redis server diff --git a/tests/test_commands.py b/tests/test_commands.py index 0912161..f4ffb63 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -696,6 +696,12 @@ class TestRedisCommands: assert isinstance(r.role()[2], list) @pytest.mark.onlynoncluster + def test_select(self, r): + assert r.select(5) + assert r.select(2) + assert r.select(9) + + @pytest.mark.onlynoncluster def test_slowlog_get(self, r, slowlog): assert r.slowlog_reset() unicode_string = chr(3456) + "abcd" + chr(3421) |