mirror of
https://github.com/microsoft/autogen.git
synced 2025-07-13 20:11:00 +00:00
20 lines
576 B
Python
20 lines
576 B
Python
import pytest
|
|
from pytest_mock import MockerFixture
|
|
from agnext.core import AgentRuntime, AGENT_INSTANTIATION_CONTEXT_VAR, 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
|
|
AGENT_INSTANTIATION_CONTEXT_VAR.set((runtime, AgentId("name", "namespace")))
|
|
|
|
agent = NoopAgent()
|
|
assert agent.runtime == runtime
|
|
assert agent.id == AgentId("name", "namespace")
|
|
|