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

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

        simple_function('some', 1, arglist=['key', 'dummy'])
        self.assertTrue(self.backend.get('some_key') == '1:cached_value')

        simple_function('some', 2, arglist=['key', 'changed'])
        self.assertTrue(self.backend.get('some_key') == '1:cached_value')

        simple_function('some_other', 1, arglist=['new_key', 'dummy'])
        self.assertTrue(self.backend.get('some_other_new_key') == '1:cached_value')

        simple_function('yet_another', 1, arglist=['new_key', 'dummy'])
        self.assertTrue(self.backend.get('yet_another_new_key') == '1:cached_value')
dataset/ETHPy150Open lonetwin/supycache/tests/test_supycache.py/TestCacheDecorators.test_decorator_for_cache_key_multi_args_complex_list/original