summaryrefslogtreecommitdiffstats
path: root/tests/unittests/command_parse/test_base_token.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-07-04 07:58:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-07-04 07:58:56 +0000
commita785d1c2de7d227674051b865935013bdd27e60f (patch)
treecf642e98373f0a1b8fbc5e772c30c334f2cd4d30 /tests/unittests/command_parse/test_base_token.py
parentAdding upstream version 1.11.1. (diff)
downloadiredis-a785d1c2de7d227674051b865935013bdd27e60f.tar.xz
iredis-a785d1c2de7d227674051b865935013bdd27e60f.zip
Adding upstream version 1.12.0.upstream/1.12.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/unittests/command_parse/test_base_token.py')
-rw-r--r--tests/unittests/command_parse/test_base_token.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/unittests/command_parse/test_base_token.py b/tests/unittests/command_parse/test_base_token.py
index b04722e..545bc92 100644
--- a/tests/unittests/command_parse/test_base_token.py
+++ b/tests/unittests/command_parse/test_base_token.py
@@ -54,3 +54,27 @@ def test_command_with_key_in_quotes(judge_command):
judge_command(
'cluster keyslot "mykey "', {"command": "cluster keyslot", "key": '"mykey "'}
)
+
+
+def test_timeout(token_should_match, token_should_not_match):
+ from iredis.redis_grammar import TIMEOUT
+
+ token_should_match(TIMEOUT, "1.1")
+ token_should_match(TIMEOUT, "1.0")
+ token_should_match(TIMEOUT, ".1")
+ token_should_match(TIMEOUT, "123123.1123")
+ token_should_not_match(TIMEOUT, "1.")
+ token_should_not_match(TIMEOUT, ".")
+ token_should_not_match(TIMEOUT, ".a")
+
+
+def test_lr_const(token_should_match, token_should_not_match):
+ from iredis.redis_grammar import LR_CONST
+
+ token_should_match(LR_CONST, "left")
+ token_should_match(LR_CONST, "right")
+ token_should_match(LR_CONST, "LEFT")
+ token_should_match(LR_CONST, "RIGHT")
+ token_should_not_match(LR_CONST, "righ")
+ token_should_not_match(LR_CONST, "ab")
+ token_should_not_match(LR_CONST, "123")