summaryrefslogtreecommitdiff
path: root/tests/test_pipeline.py
diff options
context:
space:
mode:
authorCody-G <codyjgreer@gmail.com>2020-02-08 13:19:17 -0800
committerAndy McCurdy <andy@andymccurdy.com>2020-02-24 15:38:05 -0800
commit3310fe415a4c3a6ec9a9fcaf9a9fa24808219429 (patch)
tree9f02ba16ce16ed29a86a0482a6b237c38ed6752d /tests/test_pipeline.py
parent03260002ded57223c5d05b2c99a0a710ee5d34f3 (diff)
downloadredis-py-3310fe415a4c3a6ec9a9fcaf9a9fa24808219429.tar.gz
Support memoryview encoding/decoding as a no-op
This allows memoryview instances to be passed to Redis command args that expect strings or bytes. The memoryview instance is sent directly to the socket such that there are zero copies made of the underlying data during command packing. Fixes #1265 Fixes #1285
Diffstat (limited to 'tests/test_pipeline.py')
-rw-r--r--tests/test_pipeline.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py
index 867666b..828b989 100644
--- a/tests/test_pipeline.py
+++ b/tests/test_pipeline.py
@@ -29,6 +29,16 @@ class TestPipeline(object):
[(b'z1', 2.0), (b'z2', 4)],
]
+ def test_pipeline_memoryview(self, r):
+ with r.pipeline() as pipe:
+ (pipe.set('a', memoryview(b'a1'))
+ .get('a'))
+ assert pipe.execute() == \
+ [
+ True,
+ b'a1',
+ ]
+
def test_pipeline_length(self, r):
with r.pipeline() as pipe:
# Initially empty.