Add tests for using the binary protocol.
This commit is contained in:
parent
16e964e571
commit
db1aff8129
10
pylibmc.py
10
pylibmc.py
@ -8,11 +8,11 @@ minor differences. If you should happen to spot any, file a bug!
|
|||||||
>>> b = mc.behaviors
|
>>> b = mc.behaviors
|
||||||
>>> ks = list(sorted(k for k in b.keys() if not k.startswith("_")))
|
>>> ks = list(sorted(k for k in b.keys() if not k.startswith("_")))
|
||||||
>>> ks # doctest: +NORMALIZE_WHITESPACE
|
>>> ks # doctest: +NORMALIZE_WHITESPACE
|
||||||
['binary_protocol', 'buffer_requests', 'cache_lookups', 'connect_timeout',
|
['buffer_requests', 'cache_lookups', 'connect_timeout', 'distribution', 'hash',
|
||||||
'distribution', 'hash', 'ketama', 'ketama_hash', 'ketama_weighted',
|
'ketama', 'ketama_hash', 'ketama_weighted', 'no block', 'poll_timeout',
|
||||||
'no block', 'poll_timeout', 'rcv_timeout', 'retry_timeout',
|
'rcv_timeout', 'retry_timeout', 'server_failure_limit', 'snd_timeout',
|
||||||
'server_failure_limit', 'snd_timeout', 'socket recv size', 'socket send size',
|
'socket recv size', 'socket send size', 'sort_hosts', 'support_cas',
|
||||||
'sort_hosts', 'support_cas', 'tcp_nodelay', 'udp', 'verify_key']
|
'tcp_nodelay', 'verify_key']
|
||||||
>>> b["hash"]
|
>>> b["hash"]
|
||||||
'default'
|
'default'
|
||||||
>>> b["hash"] = 'fnv1a_32'
|
>>> b["hash"] = 'fnv1a_32'
|
||||||
|
9
tests.py
9
tests.py
@ -133,6 +133,15 @@ Behaviors.
|
|||||||
>>> list(sorted((k, v) for (k, v) in c.get_behaviors().items()
|
>>> list(sorted((k, v) for (k, v) in c.get_behaviors().items()
|
||||||
... if k in ("tcp_nodelay", "hash")))
|
... if k in ("tcp_nodelay", "hash")))
|
||||||
[('hash', 6), ('tcp_nodelay', 1)]
|
[('hash', 6), ('tcp_nodelay', 1)]
|
||||||
|
|
||||||
|
Binary protocol!
|
||||||
|
>>> c = _pylibmc.client([test_server], binary=True)
|
||||||
|
>>> c.set("hello", "world")
|
||||||
|
True
|
||||||
|
>>> c.get("hello")
|
||||||
|
'world'
|
||||||
|
>>> c.delete("hello")
|
||||||
|
True
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Used to test pickling.
|
# Used to test pickling.
|
||||||
|
Reference in New Issue
Block a user