Skip to content

Commit

Permalink
fix:TestTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
cunla committed Jul 1, 2023
1 parent 214be2b commit 2f24d88
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions test/test_hypothesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,15 +512,36 @@ class TestTransaction(BaseTest):
transaction_commands = (
commands(st.sampled_from(['multi', 'discard', 'exec', 'unwatch']))
| commands(st.just('watch'), keys)
| commands(st.just('append'), keys, values)
| commands(st.just('bitcount'), keys)
| commands(st.just('bitcount'), keys, values, values)
| commands(st.sampled_from(['incr', 'decr']), keys)
| commands(st.sampled_from(['incrby', 'decrby']), keys, values)
| commands(st.just('get'), keys)
| commands(st.just('getbit'), keys, counts)
| commands(st.just('setbit'), keys, counts,
st.integers(min_value=0, max_value=1) | st.integers())
| commands(st.sampled_from(['substr', 'getrange']), keys, counts, counts)
| commands(st.just('getset'), keys, values)
| commands(st.just('mget'), st.lists(keys))
| commands(st.sampled_from(['mset', 'msetnx']), st.lists(st.tuples(keys, values)))
| commands(st.just('set'), keys, values,
st.none() | st.just('nx'),
st.none() | st.just('xx'),
st.none() | st.just('keepttl'))
| commands(st.just('setex'), keys, expires_seconds, values)
| commands(st.just('psetex'), keys, expires_ms, values)
| commands(st.just('setnx'), keys, values)
| commands(st.just('setrange'), keys, counts, values)
| commands(st.just('strlen'), keys)
)
create_command_strategy = TestString.create_command_strategy
command_strategy = transaction_commands | TestString.string_commands | common_commands
command_strategy = transaction_commands | common_commands


class TestServer(BaseTest):
# TODO: real redis raises an error if there is a save already in progress.
# Find a better way to test this.
# commands(st.just('bgsave'))
# Find a better way to test this. commands(st.just('bgsave'))
server_commands = (
commands(st.just('dbsize'))
| commands(st.sampled_from(['flushdb', 'flushall']), st.sampled_from([[], 'async']))
Expand Down

0 comments on commit 2f24d88

Please sign in to comment.