fix(huggingface): fix typing in test_standard (#32863)

This commit is contained in:
Christophe Bornet
2025-09-09 16:05:41 +02:00
committed by GitHub
parent 428c2ee6c5
commit cc3b5afe52

View File

@@ -1,5 +1,7 @@
"""Standard LangChain interface tests.""" """Standard LangChain interface tests."""
from typing import Literal
import pytest import pytest
from langchain_core.language_models import BaseChatModel from langchain_core.language_models import BaseChatModel
from langchain_core.tools import BaseTool from langchain_core.tools import BaseTool
@@ -31,7 +33,11 @@ class TestHuggingFaceEndpoint(ChatModelIntegrationTests):
reason=("Overrding, testing only typed dict and json schema structured output") reason=("Overrding, testing only typed dict and json schema structured output")
) )
@pytest.mark.parametrize("schema_type", ["typeddict", "json_schema"]) @pytest.mark.parametrize("schema_type", ["typeddict", "json_schema"])
def test_structured_output(self, model: BaseChatModel, schema_type: str) -> None: def test_structured_output(
self,
model: BaseChatModel,
schema_type: Literal["pydantic", "typeddict", "json_schema"],
) -> None:
super().test_structured_output(model, schema_type) super().test_structured_output(model, schema_type)
@pytest.mark.xfail( @pytest.mark.xfail(
@@ -39,7 +45,9 @@ class TestHuggingFaceEndpoint(ChatModelIntegrationTests):
) )
@pytest.mark.parametrize("schema_type", ["typeddict", "json_schema"]) @pytest.mark.parametrize("schema_type", ["typeddict", "json_schema"])
async def test_structured_output_async( async def test_structured_output_async(
self, model: BaseChatModel, schema_type: str self,
model: BaseChatModel,
schema_type: Literal["pydantic", "typeddict", "json_schema"],
) -> None: # type: ignore[override] ) -> None: # type: ignore[override]
super().test_structured_output(model, schema_type) super().test_structured_output(model, schema_type)