You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_base_agent.py 594 B

123456789101112131415161718
  1. import pytest
  2. from pytest_mock import MockerFixture
  3. from agnext.core import AgentRuntime, AgentInstantiationContext, AgentId
  4. from test_utils import NoopAgent
  5. @pytest.mark.asyncio
  6. async def test_base_agent_create(mocker: MockerFixture) -> None:
  7. runtime = mocker.Mock(spec=AgentRuntime)
  8. # Shows how to set the context for the agent instantiation in a test context
  9. with AgentInstantiationContext.populate_context((runtime, AgentId("name", "namespace"))):
  10. agent = NoopAgent()
  11. assert agent.runtime == runtime
  12. assert agent.id == AgentId("name", "namespace")