def test_decorator_for_cache_key_multi_args_complex_dict(self):
        """ caching a key built from elements of a dict passed as an argument
        """

        @supycache.supycache(cache_key='{0}_{argdict[lookup]}')
        def simple_function(positional, call_count, argdict=None):
            return '%d:cached_value' % call_count

        simple_function('some', 1, argdict={'lookup' : 'key'})
        self.assertTrue(self.backend.get('some_key') == '1:cached_value')

        simple_function('some', 2, argdict={'lookup' : 'key'})
        self.assertTrue(self.backend.get('some_key') == '1:cached_value')

        simple_function('some_other', 1, argdict={'lookup' : 'new_key'})
        self.assertTrue(self.backend.get('some_other_new_key') == '1:cached_value')
dataset/ETHPy150Open lonetwin/supycache/tests/test_supycache.py/TestCacheDecorators.test_decorator_for_cache_key_multi_args_complex_dict/original