| 1 |
def test_hdel(judge_command): |
| 2 |
judge_command("HDEL foo bar", {"command": "HDEL", "key": "foo", "fields": "bar"}) |
| 3 |
judge_command( |
| 4 |
"HDEL foo bar hello world", |
| 5 |
{"command": "HDEL", "key": "foo", "fields": "bar hello world"}, |
| 6 |
) |
| 7 |
|
| 8 |
|
| 9 |
def test_hmset(judge_command): |
| 10 |
judge_command( |
| 11 |
"HMSET foo bar hello-world", |
| 12 |
{"command": "HMSET", "key": "foo", "field": "bar", "value": "hello-world"}, |
| 13 |
) |
| 14 |
judge_command( |
| 15 |
"HMSET foo bar hello-world key2 value2", |
| 16 |
{"command": "HMSET", "key": "foo", "field": "key2", "value": "value2"}, |
| 17 |
) |
| 18 |
|
| 19 |
|
| 20 |
def test_hexists(judge_command): |
| 21 |
judge_command( |
| 22 |
"HEXISTS foo bar", {"command": "HEXISTS", "key": "foo", "field": "bar"} |
| 23 |
) |
| 24 |
judge_command("HEXISTS foo bar hello-world", None) |
| 25 |
|
| 26 |
|
| 27 |
def test_hincrby(judge_command): |
| 28 |
judge_command( |
| 29 |
"HINCRBY foo bar 12", |
| 30 |
{"command": "HINCRBY", "key": "foo", "field": "bar", "delta": "12"}, |
| 31 |
) |
| 32 |
|
| 33 |
|
| 34 |
def test_hincrbyfloat(judge_command): |
| 35 |
judge_command( |
| 36 |
"HINCRBYFLOAT foo bar 12.1", |
| 37 |
{"command": "HINCRBYFLOAT", "key": "foo", "field": "bar", "float": "12.1"}, |
| 38 |
) |
| 39 |
|
| 40 |
|
| 41 |
def test_hset(judge_command): |
| 42 |
judge_command( |
| 43 |
"HSET foo bar hello", |
| 44 |
{"command": "HSET", "key": "foo", "field": "bar", "value": "hello"}, |
| 45 |
) |
| 46 |
|
| 47 |
|
| 48 |
def test_hrandfield(judge_command): |
| 49 |
judge_command( |
| 50 |
"HRANDFIELD coin", |
| 51 |
{"command": "HRANDFIELD", "key": "coin"}, |
| 52 |
) |
| 53 |
judge_command( |
| 54 |
"HRANDFIELD coin -5 WITHVALUES", |
| 55 |
{ |
| 56 |
"command": "HRANDFIELD", |
| 57 |
"key": "coin", |
| 58 |
"count": "-5", |
| 59 |
"withvalues_const": "WITHVALUES", |
| 60 |
}, |
| 61 |
) |
| 62 |
judge_command( |
| 63 |
"HRANDFIELD coin -5", |
| 64 |
{"command": "HRANDFIELD", "key": "coin", "count": "-5"}, |
| 65 |
) |
| 66 |
judge_command("HRANDFIELD coin WITHVALUES", None) |