Test getting session history
(mock_llm_client, temp_workspace)
| 98 | |
| 99 | |
| 100 | def test_get_history(mock_llm_client, temp_workspace): |
| 101 | """Test getting session history""" |
| 102 | agent = Agent( |
| 103 | llm_client=mock_llm_client, |
| 104 | system_prompt="System", |
| 105 | tools=[], |
| 106 | workspace_dir=temp_workspace, |
| 107 | ) |
| 108 | |
| 109 | # Add message |
| 110 | agent.add_user_message("Test message") |
| 111 | |
| 112 | # Get history |
| 113 | history = agent.get_history() |
| 114 | |
| 115 | # Verify history is a copy (doesn't affect original messages) |
| 116 | assert len(history) == len(agent.messages) |
| 117 | assert history is not agent.messages |
| 118 | |
| 119 | # Modifying copy should not affect original messages |
| 120 | history.append(Message(role="user", content="New message")) |
| 121 | assert len(agent.messages) == 2 # Original messages unchanged |
| 122 | assert len(history) == 3 # Copy changed |
| 123 | |
| 124 | |
| 125 | @pytest.mark.asyncio |
nothing calls this directly
no test coverage detected