DataDesigner/tests/engine/processing/ginja/test_exceptions.py
Johnny Greco f8c201e085
chore: update header script to check for diffs (#195)
* update script

* update headers

* refactor a bit and add test script

* update headers

* update for edge case

* update headers

* add step to get file creation date

* use git history to get copyright year

* generation type is printed with inference parameters

* fix unit test
2026-01-09 17:10:58 -05: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