From 081162c7a255c0ae7edf3ee4fb9beac79b1f3407 Mon Sep 17 00:00:00 2001 From: ruamin Date: Thu, 14 Apr 2016 17:15:51 -0700 Subject: Fixed stats evictions conversion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed evictions conversion in base.py. evictions stat value was incorrectly being compared to β€œb’on’” previously, which resulted in a boolean. The fix makes the conversion default to int, which is in line with other numeric stats values. Augmented test_stats_conversions test case in test_client.py to test eviction value conversion --- pymemcache/client/base.py | 1 - pymemcache/test/test_client.py | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pymemcache/client/base.py b/pymemcache/client/base.py index ad845d1..c86ca71 100644 --- a/pymemcache/client/base.py +++ b/pymemcache/client/base.py @@ -53,7 +53,6 @@ STAT_TYPES = { # Settings stats b'inter': six.binary_type, - b'evictions': lambda value: value == b'on', b'growth_factor': float, b'stat_key_prefix': six.binary_type, b'umask': lambda value: int(value, 8), diff --git a/pymemcache/test/test_client.py b/pymemcache/test/test_client.py index c142e6a..e541f10 100644 --- a/pymemcache/test/test_client.py +++ b/pymemcache/test/test_client.py @@ -546,6 +546,7 @@ class TestClient(ClientTestMixin, unittest.TestCase): # Most stats are converted to int b'STAT cmd_get 2519\r\n', b'STAT cmd_set 3099\r\n', + b'STAT evictions 939\r\n', # Unless they can't be, they remain str b'STAT libevent 2.0.19-stable\r\n', @@ -565,6 +566,7 @@ class TestClient(ClientTestMixin, unittest.TestCase): expected = { b'cmd_get': 2519, b'cmd_set': 3099, + b'evictions': 939, b'libevent': b'2.0.19-stable', b'hash_is_expanding': False, b'rusage_user': 0.609165, -- cgit v1.2.1