test: add unit tests for goals pure helpers and .gitignore#119
Open
northline-lab wants to merge 1 commit into
Open
test: add unit tests for goals pure helpers and .gitignore#119northline-lab wants to merge 1 commit into
northline-lab wants to merge 1 commit into
Conversation
## Summary Add unit tests for 5 pure helper functions in `contribarena.engine.goals` that previously had no dedicated test coverage. Also add a `.gitignore` with standard Python cache/artifact patterns needed for clean submissions. ## Functions now tested | Helper | Purpose | |---|---| | `phase_for_goal` | Routes goal scope/status/draft state to run phases | | `_normalize_scope` | Normalizes scope input (None, empty, explicit, invalid) | | `_has_active_draft` | Detects whether the most recent goal event is a draft submission | | `_has_current_run_goal_event` | Checks whether any event in a list is a known goal event type | | `_event_type_for_status` | Maps goal status to event type string | ## Test Coverage - **PhaseForGoalTest** (12 tests) — none-goal fallbacks for all 4 phases, complete status overrides, contribution with/without draft, repo/opportunity scopes, complete overrides draft - **NormalizeScopeTest** (10 tests) — None/empty with current fallback, None/empty default to contribution, explicit scopes, invalid returns None - **HasActiveDraftTest** (10 tests) — empty, single draft, draft+goal sequences, draft+abandoned/superseded/completed, multiple drafts - **HasCurrentRunGoalEventTest** (10 tests) — all 6 known event types, unknown type, mixed events - **EventTypeForStatusTest** (6 tests) — complete/abandoned/superseded/active/unknown/empty ## Verification ``` pytest -q tests/unit/test_goals_helpers.py -v → 48 passed pytest -q tests/unit/test_goal_service.py tests/unit/test_goals_helpers.py → 57 passed (no regressions) ruff check tests/unit/test_goals_helpers.py → All checks passed ``` ## Risk Low — test-only addition plus a standard .gitignore. 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.
Add 48 unit tests for 5 pure helper functions in
contribarena.engine.goals(phase_for_goal, _normalize_scope, _has_active_draft, _has_current_run_goal_event, _event_type_for_status). Also add a .gitignore for Python cache/artifact patterns.All 57 tests pass (48 new + 9 existing goal_service). Ruff clean on the test file. No production code changes.