Skip to content

Commit 42680ad

Browse files
committed
Python: Add unit tests for RawGitHubCopilotAgent.default_options property
1 parent e877d62 commit 42680ad

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

python/packages/github_copilot/tests/test_github_copilot_agent.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,30 @@ def test_instructions_parameter_defaults_to_append_mode(self) -> None:
189189
"content": "Direct instructions",
190190
}
191191

192+
def test_default_options_includes_model_for_telemetry(self) -> None:
193+
"""Test that default_options merges model from settings for AgentTelemetryLayer span attributes."""
194+
agent: GitHubCopilotAgent[GitHubCopilotOptions] = GitHubCopilotAgent(
195+
default_options={"model": "claude-sonnet-4-5", "timeout": 120}
196+
)
197+
opts = agent.default_options
198+
assert opts["model"] == "claude-sonnet-4-5"
199+
200+
def test_default_options_without_model_configured(self) -> None:
201+
"""Test that default_options works correctly when no model is configured."""
202+
agent = GitHubCopilotAgent(instructions="Helper")
203+
opts = agent.default_options
204+
assert "model" not in opts
205+
assert opts.get("system_message") == {"mode": "append", "content": "Helper"}
206+
207+
def test_default_options_returns_independent_copy(self) -> None:
208+
"""Test that mutating the returned dict does not affect internal state."""
209+
agent: GitHubCopilotAgent[GitHubCopilotOptions] = GitHubCopilotAgent(
210+
default_options={"model": "gpt-5.1-mini"}
211+
)
212+
opts = agent.default_options
213+
opts["model"] = "mutated"
214+
assert agent._settings.get("model") == "gpt-5.1-mini"
215+
192216

193217
class TestGitHubCopilotAgentLifecycle:
194218
"""Test cases for agent lifecycle management."""

0 commit comments

Comments
 (0)