Skip to content

Commit dce6e6f

Browse files
committed
Merge pull request #4 from zzl0/dev
Make some attributes accessible from Python code.
2 parents b7a0f6b + 45758eb commit dce6e6f

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

libmc/_client.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,11 @@ class ThreadUnsafe(Exception):
256256

257257

258258
cdef class PyClient:
259+
cdef readonly list servers
260+
cdef readonly int comp_threshold
259261
cdef Client* _imp
260262
cdef bool_t do_split
261-
cdef int comp_threshold
262263
cdef bool_t noreply
263-
cdef list servers
264264
cdef bytes prefix
265265
cdef int last_error
266266
cdef object _thread_ident

tests/test_client.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ def setUp(self):
2727
self.compressed_mc = Client(["127.0.0.1:21211"], comp_threshold=1024)
2828
self.noreply_mc = Client(["127.0.0.1:21211"], noreply=True)
2929

30+
def test_attribute(self):
31+
"Test attributes are accessible from Python code"
32+
mc = self.mc
33+
assert hasattr(mc, 'comp_threshold')
34+
assert hasattr(mc, 'servers')
35+
3036
def test_misc(self):
3137
mc = self.mc
3238
mc.get_multi(['foo', 'tuiche'])
@@ -142,7 +148,7 @@ def test_injection(self):
142148
mc.delete('injected')
143149
mc.set('key1', '1234567890')
144150
mc.set('key1 0', '123456789012345678901234567890\r\n'
145-
'set injected 0 3600 3\r\nINJ\r\n')
151+
'set injected 0 3600 3\r\nINJ\r\n')
146152
assert mc.get('injected') is None
147153

148154
def test_maxiov(self):

0 commit comments

Comments
 (0)