def test_incr(self): memcache.set('incr', 1L) assert memcache.incr('incr', 1) == 2L assert memcache.incr('incr', 2) == 4L assert memcache.incr('DOES_NOT_EXIST', 1) == None memcache.set('foo', 'bar') assert memcache.incr('foo', 1) == None
def test_get_multi(self): memcache.delete('DOES_NOT_EXIST') memcache.set('foo', 'bar') memcache.set('bar', 'foo') result = memcache.get_multi(['foo', 'bar', 'DOES_NOT_EXIST']) assert result['foo'] == 'bar' assert result['bar'] == 'foo' assert ('DOES_NOT_EXIST' in result) == False memcache.delete('foo') memcache.delete('bar') memcache.set('x_foo', 'bar') memcache.set('x_bar', 'foo') result = memcache.get_multi(['foo', 'bar'], key_prefix='x_') assert result['foo'] == 'bar' assert result['bar'] == 'foo'
def test_decr(self): memcache.set('decr', 2) assert memcache.decr('decr', 1) == 1 assert memcache.decr('DOES_NOT_EXIST', 1) == None
def test_delete_multi(self): memcache.set('foo', 'bar') assert memcache.delete_multi(['foo']) == True memcache.set('foo', 'bar') assert memcache.delete_multi(['foo', 'DOES_NOT_EXIST']) == False assert memcache.get('foo') == None
def test_delete(self): memcache.set('foo', 'bar') assert memcache.delete('foo') == 2 assert memcache.delete('DOES_NOT_EXIST') == 1
def test_set_get(self): memcache.set('foo', 'bar') assert memcache.get('foo') == 'bar' assert memcache.get('DOES_NOT_EXIST') == None