DataDesigner/packages/data-designer-engine/tests/engine/processing/ginja/test_exceptions.py
Andre Manoel 8b79b21298 Initialize orphan Fern docs website branch
Preserves tree from previous docs-website head: 5e47d33ea8. This branch is a CI-managed publish artifact like gh-pages; source provenance is tracked in commit messages rather than Git ancestry.
2026-05-14 01:17:51 +00:00

21 lines
862 B
Python

# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
import pytest
from data_designer.engine.processing.ginja.environment import UserTemplateSandboxEnvironment
from data_designer.engine.processing.ginja.exceptions import UserTemplateUnsupportedFiltersError
def test_maybe_handle_missing_filter_exception():
env = UserTemplateSandboxEnvironment(allowed_references=["foo"])
with pytest.raises(UserTemplateUnsupportedFiltersError) as exc_info:
env.safe_render("{{ foo | asdf }}", record={"foo": 42})
exc_message = str(exc_info.value)
assert "Available filters" in exc_message
with pytest.raises(UserTemplateUnsupportedFiltersError) as exc_info:
env.validate_template("{{ foo | asdf }}")
assert "Available filters" in exc_message