From 06cba6ccd165ca8b224797e37fccb9e63f026d77 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 21 Mar 2020 11:28:17 +0100 Subject: Adding upstream version 1.9.1. Signed-off-by: Daniel Baumann --- tests/unittests/command_parse/test_set_parse.py | 40 +++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/unittests/command_parse/test_set_parse.py (limited to 'tests/unittests/command_parse/test_set_parse.py') diff --git a/tests/unittests/command_parse/test_set_parse.py b/tests/unittests/command_parse/test_set_parse.py new file mode 100644 index 0000000..d35a52b --- /dev/null +++ b/tests/unittests/command_parse/test_set_parse.py @@ -0,0 +1,40 @@ +def test_sadd(judge_command): + judge_command( + "SADD foo m1 m2 m3", {"command": "SADD", "key": "foo", "members": "m1 m2 m3"} + ) + judge_command("SADD foo m1", {"command": "SADD", "key": "foo", "members": "m1"}) + judge_command("SADD foo", None) + + +def test_sdiffstore(judge_command): + judge_command( + "SDIFFSTORE foo m1 m2 m3", + {"command": "SDIFFSTORE", "destination": "foo", "keys": "m1 m2 m3"}, + ) + judge_command( + "SDIFFSTORE foo m1", + {"command": "SDIFFSTORE", "destination": "foo", "keys": "m1"}, + ) + judge_command("SDIFFSTORE foo", None) + + +def test_is_member(judge_command): + judge_command("SISMEMBER foo m1 m2 m3", None) + judge_command( + "SISMEMBER foo m1", {"command": "SISMEMBER", "key": "foo", "member": "m1"} + ) + judge_command("SISMEMBER foo", None) + + +def test_smove(judge_command): + judge_command( + "SMOVE foo bar m2", + {"command": "SMOVE", "key": "foo", "newkey": "bar", "member": "m2"}, + ) + judge_command("SMOVE foo m1", None) + judge_command("SMOVE foo", None) + + +def test_spop(judge_command): + judge_command("SPOP set", {"command": "SPOP", "key": "set"}) + judge_command("SPOP set 3", {"command": "SPOP", "key": "set", "count": "3"}) -- cgit v1.2.3