diff options
author | Andy McCurdy <andy@andymccurdy.com> | 2018-11-04 01:37:14 -0700 |
---|---|---|
committer | Andy McCurdy <andy@andymccurdy.com> | 2018-11-04 01:37:14 -0700 |
commit | e31f8fbfb673f6b35406992ff3cbb36fd4a50d63 (patch) | |
tree | d44699fae3d38a9432f9de335c3a508e39e1c961 | |
parent | f0f0192356ab45479101b6b9098cda10d58f24ff (diff) | |
download | redis-py-e31f8fbfb673f6b35406992ff3cbb36fd4a50d63.tar.gz |
add test for non-transaction pipelines as well
-rw-r--r-- | tests/test_pipeline.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py index 8de08d2..1f3947e 100644 --- a/tests/test_pipeline.py +++ b/tests/test_pipeline.py @@ -114,9 +114,9 @@ class TestPipeline(object): assert pipe.set('z', 'zzz').execute() == [True] assert r['z'] == b('zzz') - def test_command_with_on_error_option_returns_default_value(self, r): + def test_transaction_with_empty_error_command(self, r): """ - Commands with custom ON_ERROR functionality return their default + Commands with custom EMPTY_ERROR functionality return their default values in the pipeline no matter the raise_on_error preference """ for error_switch in (True, False): @@ -128,6 +128,20 @@ class TestPipeline(object): assert result[1] == [] assert result[2] + def test_pipeline_with_empty_error_command(self, r): + """ + Commands with custom EMPTY_ERROR functionality return their default + values in the pipeline no matter the raise_on_error preference + """ + for error_switch in (True, False): + with r.pipeline(transaction=False) as pipe: + pipe.set('a', 1).mget([]).set('c', 3) + result = pipe.execute(raise_on_error=error_switch) + + assert result[0] + assert result[1] == [] + assert result[2] + def test_parse_error_raised(self, r): with r.pipeline() as pipe: # the zrem is invalid because we don't pass any keys to it |