test: add unit tests for contribarena.models.tool_results Pydantic models#120
Open
northline-lab wants to merge 1 commit into
Open
Conversation
…dels ## Summary Add focused unit tests for `contribarena.models.tool_results` Pydantic models that previously had no dedicated test coverage. ## Models now tested | Model | Purpose | |---|---| | `CommandType` | Literal type alias for command categories (verification, setup, discovery, other) | | `CommandResult` | Captures shell command execution results with stdout/stderr/exit code | | `PatchResult` | Records patch application success/failure and modified files | | `PatchOperation` | Represents a single file operation (create, update, move, delete) | | `AciResult` | ACI tool execution result with error/recovery metadata | | `AgentStep` | Single agent loop step with phase, tool, state, duration | | `RepoMetadata` | Repository metadata from GitHub API (stars, forks, language) | | `IssueCandidate` | GitHub issue with number, title, labels, timestamps | | `PullRequestCandidate` | GitHub PR with state, author, draft flag, linked issues | | `IssueLinkage` | Issue assignees, linked PRs, and recent comments | | `RepoSetupProbeResult` | Repository setup probe outcome with package managers and CI | | `RepoReadmeResult` | Repository README fetch result with content and path | | `EligibilityResult` | Repository eligibility check with reasons, warnings, checks | ## Test Coverage - **CommandTypeLiteralTest** (2 tests) — literal values pinned, invalid value rejected - **CommandResultTest** (5 tests) — required fields, defaults, explicit values, all literal values accepted - **PatchResultTest** (4 tests) — required fields, defaults, explicit values, factory independence - **PatchOperationTest** (3 tests) — required fields, defaults, explicit values - **AciResultTest** (4 tests) — required fields, defaults, explicit values, factory independence - **AgentStepTest** (3 tests) — required fields, defaults, explicit values - **RepoMetadataTest** (3 tests) — required fields, defaults, explicit values - **IssueCandidateTest** (4 tests) — required fields, defaults, explicit values, factory independence - **PullRequestCandidateTest** (5 tests) — required fields, defaults, explicit values, factory independence for labels and linked_issues - **IssueLinkageTest** (6 tests) — required fields, defaults, explicit values with nested PRs, factory independence - **RepoSetupProbeResultTest** (7 tests) — required fields, defaults, explicit values, factory independence for 3 list fields - **RepoReadmeResultTest** (4 tests) — required fields, defaults, explicit values, unsuccessful result with error - **EligibilityResultTest** (5 tests) — required fields, defaults, explicit values, factory independence - **ToolResultsImportTest** (1 test) — all 12 symbols importable from models package No production code is modified. ## Verification - `pytest -q tests/unit/test_tool_results_models.py` → 61 passed in 0.22s - `ruff check tests/unit/test_tool_results_models.py` → All checks passed - No secrets in diff ## Risk Low — test-only addition. No production code is modified. --- *Prepared by ContribArena in owned-live mode.*
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add focused unit tests for
contribarena.models.tool_resultsPydantic models that previously had no dedicated test coverage.Models now tested
CommandTypeCommandResultPatchResultPatchOperationAciResultAgentStepRepoMetadataIssueCandidatePullRequestCandidateIssueLinkageRepoSetupProbeResultRepoReadmeResultEligibilityResultTest Coverage
No production code is modified.
Verification
pytest -q tests/unit/test_tool_results_models.py→ 61 passed in 0.22sruff check tests/unit/test_tool_results_models.py→ All checks passedRisk
Low — test-only addition. No production code is modified.
Prepared by ContribArena in owned-live mode.