MCPcopy
hub / github.com/huggingface/smolagents / test_replay_with_chatmessage

Method test_replay_with_chatmessage

tests/test_monitoring.py:190–201  ·  view source on GitHub ↗

Regression test for dict(message) to message.dict() fix

(self)

Source from the content-addressed store, hash-verified

188
189class ReplayTester(unittest.TestCase):
190 def test_replay_with_chatmessage(self):
191 """Regression test for dict(message) to message.dict() fix"""
192 logger = AgentLogger()
193 memory = AgentMemory(system_prompt="test")
194 step = ActionStep(step_number=1, timing=0)
195 step.model_input_messages = [ChatMessage(role=MessageRole.USER, content="Hello")]
196 memory.steps.append(step)
197
198 try:
199 memory.replay(logger, detailed=True)
200 except TypeError as e:
201 self.fail(f"Replay raised an error: {e}")
202
203
204class AgentLoggerLogTaskTester(unittest.TestCase):

Callers

nothing calls this directly

Calls 6

replayMethod · 0.95
AgentLoggerClass · 0.90
AgentMemoryClass · 0.90
ActionStepClass · 0.90
ChatMessageClass · 0.90
appendMethod · 0.80

Tested by

no test coverage detected