standard-tests[patch]: resolve pydantic warnings (#26190)

This commit is contained in:
Bagatur
2024-09-09 10:34:57 -07:00
committed by GitHub
parent b8fc82b84b
commit 71268f7a15
4 changed files with 15 additions and 3 deletions

View File

@@ -46,6 +46,9 @@ markers = [
"scheduled: mark tests to run in scheduled testing", "scheduled: mark tests to run in scheduled testing",
] ]
asyncio_mode = "auto" asyncio_mode = "auto"
filterwarnings = [
"ignore::langchain_core._api.beta_decorator.LangChainBetaWarning",
]
[tool.poetry.group.test] [tool.poetry.group.test]
optional = true optional = true

View File

@@ -633,7 +633,9 @@ def test_bind_tools_tool_choice(tool_choice: Any, strict: Optional[bool]) -> Non
) )
@pytest.mark.parametrize("schema", [GenerateUsername, GenerateUsername.schema()]) @pytest.mark.parametrize(
"schema", [GenerateUsername, GenerateUsername.model_json_schema()]
)
@pytest.mark.parametrize("method", ["json_schema", "function_calling", "json_mode"]) @pytest.mark.parametrize("method", ["json_schema", "function_calling", "json_mode"])
@pytest.mark.parametrize("include_raw", [True, False]) @pytest.mark.parametrize("include_raw", [True, False])
@pytest.mark.parametrize("strict", [True, False, None]) @pytest.mark.parametrize("strict", [True, False, None])

View File

@@ -79,7 +79,8 @@ def my_adder(a: int, b: int) -> int:
class ChatModelTests(BaseStandardTests): class ChatModelTests(BaseStandardTests):
@property @property
@abstractmethod @abstractmethod
def chat_model_class(self) -> Type[BaseChatModel]: ... def chat_model_class(self) -> Type[BaseChatModel]:
...
@property @property
def chat_model_params(self) -> dict: def chat_model_params(self) -> dict:
@@ -187,7 +188,12 @@ class ChatModelUnitTests(ChatModelTests):
tools = [my_adder_tool, my_adder] tools = [my_adder_tool, my_adder]
for pydantic_model in TEST_PYDANTIC_MODELS: for pydantic_model in TEST_PYDANTIC_MODELS:
tools.extend([pydantic_model, pydantic_model.schema()]) model_schema = (
pydantic_model.model_json_schema()
if hasattr(pydantic_model, "model_json_schema")
else pydantic_model.schema()
)
tools.extend([pydantic_model, model_schema])
# Doing a mypy ignore here since some of the tools are from pydantic # Doing a mypy ignore here since some of the tools are from pydantic
# BaseModel 2 which isn't typed properly yet. This will need to be fixed # BaseModel 2 which isn't typed properly yet. This will need to be fixed

View File

@@ -82,3 +82,4 @@ markers = [
"compile: mark placeholder test used to compile integration tests without running them", "compile: mark placeholder test used to compile integration tests without running them",
] ]
asyncio_mode = "auto" asyncio_mode = "auto"