diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-07-04 07:58:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-07-04 07:58:56 +0000 |
commit | a785d1c2de7d227674051b865935013bdd27e60f (patch) | |
tree | cf642e98373f0a1b8fbc5e772c30c334f2cd4d30 /tests/unittests/command_parse/test_generic_parse.py | |
parent | Adding upstream version 1.11.1. (diff) | |
download | iredis-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_generic_parse.py')
-rw-r--r-- | tests/unittests/command_parse/test_generic_parse.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/unittests/command_parse/test_generic_parse.py b/tests/unittests/command_parse/test_generic_parse.py index f41d887..6c4b0f3 100644 --- a/tests/unittests/command_parse/test_generic_parse.py +++ b/tests/unittests/command_parse/test_generic_parse.py @@ -177,3 +177,42 @@ def test_restore(judge_command): "value": '"\n\x17\x17\x00\x00\x00\x12\x00\x00\x00\x03\x00\x00\xc0\x01\x00\x04\xc0\x02\x00\x04\xc0\x03\x00\xff\x04\x00u#<\xc0;.\xe9\xdd"', # noqa }, ) + + +def test_copy(judge_command): + judge_command( + "COPY foo bar DB 3 REPLACE", + { + "command": "COPY", + "key": ["foo", "bar"], + "db_const": "DB", + "index": "3", + "replace_const": "REPLACE", + }, + ) + judge_command( + "COPY foo bar REPLACE", + {"command": "COPY", "key": ["foo", "bar"], "replace_const": "REPLACE"}, + ) + judge_command("COPY foo bar", {"command": "COPY", "key": ["foo", "bar"]}) + + +def test_getex(judge_command): + judge_command("GETEX foo", {"command": "GETEX", "key": "foo"}) + judge_command( + "GETEX bar ex 5", + {"command": "GETEX", "key": "bar", "expiration": "ex", "millisecond": "5"}, + ) + judge_command( + "GETEX bar px 5", + {"command": "GETEX", "key": "bar", "expiration": "px", "millisecond": "5"}, + ) + judge_command( + "GETEX bar pxat 5", + {"command": "GETEX", "key": "bar", "pxat_const": "pxat", "timestampms": "5"}, + ) + judge_command( + "GETEX bar exat 5", + {"command": "GETEX", "key": "bar", "exat_const": "exat", "timestamp": "5"}, + ) + judge_command("GETEX bar ex 5 exat 5", None) |