Skip to content

Commit

Permalink
Add test for pipeline.transaction(value_from_callable=True)
Browse files Browse the repository at this point in the history
  • Loading branch information
andymccurdy committed Dec 30, 2019
1 parent ff69f0d commit 9cbb48a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions tests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,14 @@ def my_transaction(pipe):
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:
Expand Down

0 comments on commit 9cbb48a

Please sign in to comment.