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):
def resolve_or_missing(self, key):
res = super().resolve_or_missing(key)
if res is not Undefined:
if not isinstance(res, Undefined):
return res
try:
return self.parent["ref"](key)
except KeyError:
return Undefined()
# If the key is not found in the normal context, try to resolve it as a reference
return self.parent["ref"](key)
class Environment(SandboxedEnvironment):
context_class = Context