Add tests for using the binary protocol.

This commit is contained in:
lericson 2009-09-21 17:20:53 +02:00
parent 16e964e571
commit db1aff8129
2 changed files with 14 additions and 5 deletions

View File

@ -8,11 +8,11 @@ minor differences. If you should happen to spot any, file a bug!
>>> b = mc.behaviors
>>> ks = list(sorted(k for k in b.keys() if not k.startswith("_")))
>>> ks # doctest: +NORMALIZE_WHITESPACE
['binary_protocol', 'buffer_requests', 'cache_lookups', 'connect_timeout',
'distribution', 'hash', 'ketama', 'ketama_hash', 'ketama_weighted',
'no block', 'poll_timeout', 'rcv_timeout', 'retry_timeout',
'server_failure_limit', 'snd_timeout', 'socket recv size', 'socket send size',
'sort_hosts', 'support_cas', 'tcp_nodelay', 'udp', 'verify_key']
['buffer_requests', 'cache_lookups', 'connect_timeout', 'distribution', 'hash',
'ketama', 'ketama_hash', 'ketama_weighted', 'no block', 'poll_timeout',
'rcv_timeout', 'retry_timeout', 'server_failure_limit', 'snd_timeout',
'socket recv size', 'socket send size', 'sort_hosts', 'support_cas',
'tcp_nodelay', 'verify_key']
>>> b["hash"]
'default'
>>> b["hash"] = 'fnv1a_32'

View File

@ -133,6 +133,15 @@ Behaviors.
>>> list(sorted((k, v) for (k, v) in c.get_behaviors().items()
... if k in ("tcp_nodelay", "hash")))
[('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.