autogen/python/tests/test_base_agent.py
Jack Gerrits 3d515a734b Rename agnext.core module to agnext.base (#416)
* rename core module to base

* Rename agnext.core to agnext.base
2024-08-28 12:14:35 -04:00

19 lines
594 B
Python

import pytest
from pytest_mock import MockerFixture
from agnext.base import AgentRuntime, AgentInstantiationContext, AgentId
from test_utils import NoopAgent
@pytest.mark.asyncio
async def test_base_agent_create(mocker: MockerFixture) -> None:
runtime = mocker.Mock(spec=AgentRuntime)
# Shows how to set the context for the agent instantiation in a test context
with AgentInstantiationContext.populate_context((runtime, AgentId("name", "namespace"))):
agent = NoopAgent()
assert agent.runtime == runtime
assert agent.id == AgentId("name", "namespace")