diff options
Diffstat (limited to '')
-rw-r--r-- | tests/unittests/command_parse/test_base_token.py | 24 |
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") |