from mako.cache import CacheImpl from mako.cache import register_plugin from mako.template import Template from .assertions import eq_ from .config import config
if filters:
output = filters(output)
eq_(output, expected)
def indicates_unbound_local_error(self, rendered_output, unbound_var):
var = f"'{unbound_var}'"
error_msgs = ( # < 3.11
f"local variable {var} referenced before assignment", # >= 3.11
f"cannot access local variable {var} where it is not associated",
) return any((msg in rendered_output) for msg in error_msgs)
class PlainCacheImpl(CacheImpl): """Simple memory cache impl so that tests which
use caching can run without beaker."""
def get_or_create(self, key, creation_function, **kw): if key in self.data: return self.data[key] else:
self.data[key] = data = creation_function(**kw) return data
def put(self, key, value, **kw):
self.data[key] = value
def get(self, key, **kw): return self.data[key]
def invalidate(self, key, **kw): del self.data[key]
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.