From e31f8fbfb673f6b35406992ff3cbb36fd4a50d63 Mon Sep 17 00:00:00 2001 From: Andy McCurdy Date: Sun, 4 Nov 2018 01:37:14 -0700 Subject: add test for non-transaction pipelines as well --- tests/test_pipeline.py | 18 ++++++++++++++++-- 1 file 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 -- cgit v1.2.1