The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community[patch]: Optimize test case for `MoonshotChat` (#25050)
ZhangShenaocda79dbb6c87
diff --git a/libs/community/tests/integration_tests/chat_models/test_moonshot.py b/libs/community/tests/integration_tests/chat_models/test_moonshot.pyindex a44b485716..58ea6de5e0 100644--- a/libs/community/tests/integration_tests/chat_models/test_moonshot.py+++ b/libs/community/tests/integration_tests/chat_models/test_moonshot.py@@ -1,36 +1,23 @@"""Test Moonshot Chat Model."""-from langchain_core.messages import AIMessage, BaseMessage, HumanMessage--from langchain_community.chat_models.moonshot import MoonshotChat+from typing import Type+import pytest+from langchain_core.language_models import BaseChatModel+from langchain_standard_tests.integration_tests import ChatModelIntegrationTests-def test_default_call() -> None:- """Test default model call."""- chat = MoonshotChat() # type: ignore[call-arg]- response = chat.invoke([HumanMessage(content="How are you?")])- assert isinstance(response, BaseMessage)- assert isinstance(response.content, str)-+from langchain_community.chat_models.moonshot import MoonshotChat-def test_model() -> None:- """Test model kwarg works."""- chat = MoonshotChat(model="moonshot-v1-32k") # type: ignore[call-arg]- response = chat.invoke([HumanMessage(content="How are you?")])- assert isinstance(response, BaseMessage)- assert isinstance(response.content, str)+class TestMoonshotChat(ChatModelIntegrationTests):+ @property+ def chat_model_class(self) -> Type[BaseChatModel]:+ return MoonshotChat-def test_multiple_history() -> None:- """Tests multiple history works."""- chat = MoonshotChat() # type: ignore[call-arg]+ @property+ def chat_model_params(self) -> dict:+ return {"model": "moonshot-v1-8k"}- response = chat.invoke(- [- HumanMessage(content="How are you?"),- AIMessage(content="I'm fine, and you?"),- HumanMessage(content="Not bad!"),- ]- )- assert isinstance(response, BaseMessage)- assert isinstance(response.content, str)+ @pytest.mark.xfail(reason="Not yet implemented.")+ def test_usage_metadata(self, model: BaseChatModel) -> None:+ super().test_usage_metadata(model)