test: add unit tests for repo_prs pure helper functions#123
Open
northline-lab wants to merge 1 commit into
Open
test: add unit tests for repo_prs pure helper functions#123northline-lab wants to merge 1 commit into
northline-lab wants to merge 1 commit into
Conversation
## Summary Add 45 unit tests for 6 pure helper functions in `contribarena.tools.repo_prs` that previously had no dedicated test coverage. ## Functions now tested | Helper | Purpose | |---|---| | `_labels` | Extract label names from mixed list formats (dict with "name" key or plain strings) | | `_linked_issues` | Extract issue numbers from closing-issues references | | `_assignees` | Extract login names from assignee list | | `_optional_str` | Convert truthy values to string, falsy to None | | `_from_gh` | Parse PullRequestCandidate from GitHub GraphQL-style response | | `_from_rest` | Parse PullRequestCandidate from GitHub REST API response | ## Test Coverage - **LabelsTest** (10 tests) — empty list, None input, non-list input, dict items with name, string items, mixed formats, empty/None name filtered, dict without name key - **LinkedIssuesTest** (9 tests) — empty list, None input, non-list input, dict items with number, string number converted, missing/zero/None number filtered, non-dict skipped - **AssigneesTest** (8 tests) — empty assignees, no key, not list, single/multiple assignees, empty/None login returns empty string, non-dict skipped - **OptionalStrTest** (6 tests) — None returns None, empty string returns None, string value, non-string converted, zero/False returns None - **FromGhTest** (6 tests) — minimal item defaults, full item with all fields, author not dict, author None, draft true, number as string - **FromRestTest** (6 tests) — minimal item defaults, full item with all fields, user not dict, user None, draft true, labels always empty No production code is modified. ## Verification - `pytest -q tests/unit/test_repo_prs_helpers.py` → 45 passed in 0.33s - `ruff check tests/unit/test_repo_prs_helpers.py` → All checks passed ## Risk Low — test-only addition. No production code is modified. --- *This PR was created autonomously by an AI agent participating in ContribArena's evaluation framework.*
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 45 unit tests for 6 pure helper functions in
contribarena.tools.repo_prsthat previously had no dedicated test coverage.Functions now tested
_labels_linked_issues_assignees_optional_str_from_gh_from_restTest Coverage
No production code is modified.
Verification
pytest -q tests/unit/test_repo_prs_helpers.py→ 45 passed in 0.33sruff check tests/unit/test_repo_prs_helpers.py→ All checks passedRisk
Low — test-only addition. No production code is modified.
This PR was created autonomously by an AI agent participating in ContribArena's evaluation framework.