diff options
author | laixintao <laixintaoo@gmail.com> | 2021-03-08 15:13:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-08 15:13:45 +0800 |
commit | 5f4d69708e52ed7e0fcabb62828c233c2facc206 (patch) | |
tree | 5d16d117a8af1bcfcafb87610c1fa88bc4c36044 | |
parent | ad936550422c62c1e5cedd1d8266cd95788fbcac (diff) |
bugfix: fix typos of valid and internal. (#378)
* bugfix: fix typos of valid and internal.
Co-authored-by: landybird <37992065+landybird@users.noreply.github.com>
* bugfix: fix testcase.
* bugfix: compact with redis5
Co-authored-by: landybird <37992065+landybird@users.noreply.github.com>
-rw-r--r-- | iredis/bottom.py | 2 | ||||
-rw-r--r-- | iredis/client.py | 6 | ||||
-rw-r--r-- | iredis/commands.py | 2 | ||||
-rw-r--r-- | iredis/completers.py | 2 | ||||
-rw-r--r-- | iredis/renders.py | 2 | ||||
-rw-r--r-- | iredis/utils.py | 2 | ||||
-rw-r--r-- | tests/cli_tests/test_command_input.py | 8 |
7 files changed, 15 insertions, 9 deletions
diff --git a/iredis/bottom.py b/iredis/bottom.py index 28746f8..c0abed8 100644 --- a/iredis/bottom.py +++ b/iredis/bottom.py @@ -24,7 +24,7 @@ class BottomToolbar: def render(self): text = BUTTOM_TEXT - # add command help if valide + # add command help if valid if self.command_holder.command: try: command_info = commands_summary[self.command_holder.command] diff --git a/iredis/client.py b/iredis/client.py index 61613dc..e1400b1 100644 --- a/iredis/client.py +++ b/iredis/client.py @@ -338,7 +338,7 @@ class Client: grammar = completer.get_completer(input_text=rawinput).compiled_grammar matched = grammar.match(rawinput) if not matched: - # invalide command! + # invalid command! return rawinput, None variables = matched.variables() shell_command = variables.get("shellcommand") @@ -486,7 +486,7 @@ class Client: redis_grammar = completer.get_completer(command).compiled_grammar m = redis_grammar.match(command) if not m: - # invalide command! + # invalid command! return variables = m.variables() # zset withscores @@ -501,7 +501,7 @@ class Client: doc = read_text(commands_data, f"{command_docs_name}.md") except FileNotFoundError: raise NotRedisCommand( - f"{command_summary_name} is not a valide Redis command." + f"{command_summary_name} is not a valid Redis command." ) rendered_detail = markdown.render(doc) summary_dict = commands_summary[command_summary_name] diff --git a/iredis/commands.py b/iredis/commands.py index 358c8b7..574f336 100644 --- a/iredis/commands.py +++ b/iredis/commands.py @@ -135,7 +135,7 @@ def split_command_args(command): input_args = command[matcher.end() :] break else: - raise InvalidArguments(f"`{command}` is not a valide Redis Command") + raise InvalidArguments(f"`{command}` is not a valid Redis Command") args = list(strip_quote_args(input_args)) diff --git a/iredis/completers.py b/iredis/completers.py index 6756637..afdc7ef 100644 --- a/iredis/completers.py +++ b/iredis/completers.py @@ -191,7 +191,7 @@ class IRedisCompleter(Completer): grammar = completer.compiled_grammar m = grammar.match(command) if not m: - # invalide command! + # invalid command! return variables = m.variables() diff --git a/iredis/renders.py b/iredis/renders.py index 97defea..8fa0f54 100644 --- a/iredis/renders.py +++ b/iredis/renders.py @@ -78,7 +78,7 @@ class OutputRender: @staticmethod def render_nested_pair(value): """ - For redis internel responses. + For redis internal responses. Always decode with utf-8 Render nested list. Items come as pairs. diff --git a/iredis/utils.py b/iredis/utils.py index ed42daf..b64f874 100644 --- a/iredis/utils.py +++ b/iredis/utils.py @@ -40,7 +40,7 @@ def literal_bytes(b): return b -def _valide_token(words): +def _valid_token(words): token = "".join(words).strip() if token: yield token diff --git a/tests/cli_tests/test_command_input.py b/tests/cli_tests/test_command_input.py index 4f970f5..b5eba48 100644 --- a/tests/cli_tests/test_command_input.py +++ b/tests/cli_tests/test_command_input.py @@ -1,3 +1,4 @@ +import os import pytest @@ -8,8 +9,13 @@ def test_wrong_select_db_index(cli): cli.sendline("select 128") cli.expect(["DB index is out of range", "127.0.0.1:6379[1]>"]) + if int(os.environ["REDIS_VERSION"]) > 5: + text = "value is not an integer or out of range" + else: + text = "invalid DB index" + cli.sendline("select abc") - cli.expect(["invalid DB index", "127.0.0.1:6379[1]>"]) + cli.expect([text, "127.0.0.1:6379[1]>"]) cli.sendline("select 15") cli.expect("OK") |