/usr/lib/python2.7/dist-packages/pymemcache/test/test_utils.py is in python-pymemcache 1.3.2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | import six
import pytest
from pymemcache.test.utils import MockMemcacheClient
@pytest.mark.unit()
def test_get_set():
client = MockMemcacheClient()
assert client.get(b"hello") is None
client.set(b"hello", 12)
assert client.get(b"hello") == 12
@pytest.mark.unit()
def test_get_many_set_many():
client = MockMemcacheClient()
client.set(b"h", 1)
result = client.get_many([b"h", b"e", b"l", b"o"])
assert result == {b"h": 1}
# Convert keys into bytes
d = dict((k.encode('ascii'), v)
for k, v in six.iteritems(dict(h=1, e=2, l=3)))
client.set_many(d)
assert client.get_many([b"h", b"e", b"l", b"o"]) == d
@pytest.mark.unit()
def test_add():
client = MockMemcacheClient()
client.add(b"k", 2)
assert client.get(b"k") == 2
client.add(b"k", 25)
assert client.get(b"k") == 2
@pytest.mark.unit()
def test_delete():
client = MockMemcacheClient()
client.add(b"k", 2)
assert client.get(b"k") == 2
client.delete(b"k")
assert client.get(b"k") is None
@pytest.mark.unit()
def test_incr_decr():
client = MockMemcacheClient()
client.add(b"k", 2)
client.incr(b"k", 4)
assert client.get(b"k") == 6
client.decr(b"k", 2)
assert client.get(b"k") == 4
|