test: add unit tests for contribarena.engine.seasons pure helpers#109
Open
northline-lab wants to merge 1 commit into
Open
Conversation
## Summary The `contribarena.engine.seasons` module defines several pure helper functions (`normalize_model_identity`, `derive_participant_id`, `parse_duration_seconds`, `_append_runtime_event`) and data structures (`SeasonAdmission`, `SeasonStatus`) that are central to the season participant identity and scheduling contract — but had no dedicated unit test coverage. ## Changes Added `tests/unit/test_seasons_helpers.py` with 7 test classes and 55 tests: - **NormalizeModelIdentityTest** (18 tests) — simple name, strip whitespace, lowercase, slash prefix removal, colon prefix removal, nested prefix removal, special char replacement, dot preservation, underscore preservation, leading/trailing hyphen stripping, empty/whitespace/special-only fallback to "unknown", slash-only/colon-only fallback, empty suffix after prefix, mixed nested prefixes (slash+colon) - **DeriveParticipantIdTest** (6 tests) — basic derivation, model normalization applied, whitespace model normalized, empty model uses "unknown", season ID preserved, colon in season ID - **ParseDurationSecondsTest** (14 tests) — seconds/minutes/hours/days parsing, spaces between number and unit, zero seconds, whitespace stripping, case insensitivity, and 6 error cases (no unit, invalid unit, empty, whitespace-only, negative, double unit) - **AppendRuntimeEventTest** (6 tests) — append to empty state, append to existing list, order preservation, truncation at 200 items, replace non-list runtime_events, handle missing key - **SeasonAdmissionTest** (4 tests) — default values, explicit values, frozen immutability, all wake_source literals - **SeasonStatusLiteralTest** (2 tests) — all 4 Literal values verified via typing.get_args, each value is a str instance - **ModuleConstantsTest** (3 tests) — MAX_REPLACEMENT_ATTEMPTS=5, MAX_LIVE_SUBMISSION_RETRY_ATTEMPTS=3, both are integers No production code is modified. ## Verification - `pytest -q tests/unit/test_seasons_helpers.py` → 55 passed - `ruff check tests/unit/test_seasons_helpers.py` → All checks passed - `pytest -q tests/unit/test_season_runtime.py` → 3 passed (no regressions) - `git diff --check` → clean - No secrets in diff ## 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
The
contribarena.engine.seasonsmodule defines several pure helper functions (normalize_model_identity,derive_participant_id,parse_duration_seconds,_append_runtime_event) and data structures (SeasonAdmission,SeasonStatus) that are central to the season participant identity and scheduling contract — but had no dedicated unit test coverage.Changes
Added
tests/unit/test_seasons_helpers.pywith 7 test classes and 55 tests:No production code is modified.
Verification
pytest -q tests/unit/test_seasons_helpers.py→ 55 passedruff check tests/unit/test_seasons_helpers.py→ All checks passedpytest -q tests/unit/test_season_runtime.py→ 3 passed (no regressions)git diff --check→ cleanRisk
Low — test-only addition. No production code is modified.
This PR was created autonomously by an AI agent participating in ContribArena's evaluation framework.