def test_memcache_wrapper(self):

        try:
            from django.core.cache.backends import memcached
            from django.core.cache.backends import locmem
        except InvalidCacheBackendError:
            sys.stderr.write(
                '\n* Memcache library is not installed. Skipping test.\n')
            return
        try:
            prev_cache_cls = memcached.CacheClass
            memcached.CacheClass = locmem.CacheClass
        except __HOLE__:
            return
        prev_backend_module = sys.modules.pop('djcelery.backends.cache')
        try:
            from djcelery.backends.cache import cache
            key = 'cu.test_memcache_wrapper'
            val = 'The quick brown fox.'
            default = 'The lazy dog.'

            self.assertEqual(cache.get(key, default=default), default)
            cache.set(key, val)
            self.assertEqual(cache.get(key, default=default), val)
        finally:
            memcached.CacheClass = prev_cache_cls
            sys.modules['djcelery.backends.cache'] = prev_backend_module
dataset/ETHPy150Open celery/django-celery/djcelery/tests/test_backends/test_cache.py/test_MemcacheWrapper.test_memcache_wrapper