summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2019-12-29 16:33:02 -0800
committerAndy McCurdy <andy@andymccurdy.com>2019-12-29 16:33:02 -0800
commit9cbb48aaa31752f8d707af9b4ec8c90a48e7f8bb (patch)
tree3eb3c2d062595bc447627615a8b8c80ca02045e4
parentff69f0d77284643909462ee6d1e37233c6677672 (diff)
downloadredis-py-9cbb48aaa31752f8d707af9b4ec8c90a48e7f8bb.tar.gz
Add test for pipeline.transaction(value_from_callable=True)
-rw-r--r--CHANGES2
-rw-r--r--tests/test_pipeline.py8
2 files changed, 9 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index a10440c..6a42125 100644
--- a/CHANGES
+++ b/CHANGES
@@ -13,7 +13,7 @@
* Client instances and Connection pools now support a 'client_name'
argument. If supplied, all connections created will call CLIENT SETNAME
as soon as the connection is opened. Thanks to @Habbie for supplying
- the basis of this chanfge. #802
+ the basis of this change. #802
* Added the 'ssl_check_hostname' argument to specify whether SSL
connections should require the server hostname to match the hostname
specified in the SSL cert. By default 'ssl_check_hostname' is False
diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py
index 08b7fba..867666b 100644
--- a/tests/test_pipeline.py
+++ b/tests/test_pipeline.py
@@ -242,6 +242,14 @@ class TestPipeline(object):
assert result == [True]
assert r['c'] == b'4'
+ def test_transaction_callable_returns_value_from_callable(self, r):
+ def callback(pipe):
+ # No need to do anything here since we only want the return value
+ return 'a'
+
+ res = r.transaction(callback, 'my-key', value_from_callable=True)
+ assert res == 'a'
+
def test_exec_error_in_no_transaction_pipeline(self, r):
r['a'] = 1
with r.pipeline(transaction=False) as pipe: