add test for non-transaction pipelines as well
@@ -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
