Skip to content

Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.

fix unit tests

thomashebrard444157d2d716
diff --git a/tests/test_pipelines/test_structures_complex.py b/tests/test_pipelines/test_structures_complex.py
index 0e02c42ac..444b88661 100644
--- a/tests/test_pipelines/test_structures_complex.py
+++ b/tests/test_pipelines/test_structures_complex.py
@@ -1,13 +1,10 @@
from __future__ import annotations
-from typing import TYPE_CHECKING
-
from pydantic import Field
from pipelex.core.stuffs.stuff_content import StructuredContent
-
-if TYPE_CHECKING:
- from tests.test_pipelines.test_structures_basic import ConceptWithOptionals, ConceptWithSimpleStructure
+from pipelex.tools.typing.pydantic_utils import empty_list_factory_of
+from tests.test_pipelines.test_structures_basic import ConceptWithOptionals, ConceptWithSimpleStructure
class ConceptWithDicts(StructuredContent):
@@ -40,6 +37,7 @@ class ConceptWithNestedUnions(StructuredContent):
simple_or_complex: ConceptWithSimpleStructure | ConceptWithOptionals = Field(..., description="Simple or complex structure")
list_of_union_structures: list[ConceptWithSimpleStructure | ConceptWithUnions] = Field(
+ default_factory=empty_list_factory_of(ConceptWithSimpleStructure),
description="List of different structure types",
)
optional_nested_union: ConceptWithUnions | ConceptWithComplexUnions | None = Field(
diff --git a/tests/unit/pipelex/tools/templating/test_template_preprocessor.py b/tests/unit/pipelex/tools/templating/test_template_preprocessor.py
index d9e630593..d6b414880 100644
--- a/tests/unit/pipelex/tools/templating/test_template_preprocessor.py
+++ b/tests/unit/pipelex/tools/templating/test_template_preprocessor.py
@@ -140,7 +140,7 @@ Optional notes:
"""Test multiple @variable patterns with trailing dots."""
template = "Extract all articles from this invoice text: @invoice_text. Process the items: @item_list."
result = preprocess_template(template)
- expected = """Extract all articles from this invoice text: {{ invoice_text|tag("invoice_text") }}. Process the items: {{ item_list|tag("item_list") }}.""" #noqa: E501
+ expected = """Extract all articles from this invoice text: {{ invoice_text|tag("invoice_text") }}. Process the items: {{ item_list|tag("item_list") }}.""" # noqa: E501
pretty_print(result, title="result")
pretty_print(expected, title="expected")