fix unit tests

This commit is contained in:
Jan Suhr 2025-07-28 11:17:51 +02:00
parent f74bf47e70
commit f0ef1bcce4

View File

@ -23,12 +23,10 @@ try:
class Context(SandboxedEnvironment.context_class): class Context(SandboxedEnvironment.context_class):
def resolve_or_missing(self, key): def resolve_or_missing(self, key):
res = super().resolve_or_missing(key) res = super().resolve_or_missing(key)
if res is not Undefined: if not isinstance(res, Undefined):
return res return res
try: # If the key is not found in the normal context, try to resolve it as a reference
return self.parent["ref"](key) return self.parent["ref"](key)
except KeyError:
return Undefined()
class Environment(SandboxedEnvironment): class Environment(SandboxedEnvironment):
context_class = Context context_class = Context