Parent: #297
Depends on: #303
Goal
Add tests that protect against behavioral drift between synchronous Mlb methods and their asynchronous AsyncMlb equivalents.
Contract source
#298 defines the public async contract. These tests should compare externally visible behavior, not require sync and async internals to be architecturally identical.
Scope
For endpoints implemented in both clients, feed equivalent response fixtures through each path and compare:
- Returned model types
- Parsed field values
None, [], and {} behavior
- Endpoint-specific 404 behavior
- Structured exception types and key attributes
- Strict HTTP behavior
- Explicit compatibility-mode behavior
- Successful empty-body behavior
- JSON decode error behavior
- Timeout and transport exception semantics where the endpoint path exposes them
Initial parity coverage must include:
get_team
get_person
get_schedule
Contract requirements from #298
Equivalent sync/async behavior should include:
2xx -> equivalent domain result
404 -> equivalent endpoint-specific empty behavior
non-404 4xx + strict=True -> MlbHttpError
non-404 4xx + strict=False -> compatibility warning + equivalent empty behavior
5xx -> MlbHttpError
timeout -> MlbTimeoutError
transport failure -> MlbTransportError
invalid successful JSON -> MlbDecodeError
Also compare where practical:
MlbHttpError status code, reason, URL, method, and public response context
MlbHttpCompatibilityWarning category and caller-facing behavior
- Parsing/model output from shared helpers
- Public constructor defaults and endpoint signatures that are intended to mirror sync
Async-specific semantics such as asyncio.CancelledError, aclose(), and concurrent same-client usage belong primarily to #302/#303 and do not need artificial sync equivalents.
Constraints
- Compare public behavior, not private implementation details
- Do not require sync and async transports to use the same HTTP library or retry implementation
- Keep tests deterministic and offline
- Existing synchronous behavior is the compatibility baseline; do not change sync solely to make a parity test easier
Acceptance criteria
Refs #297
Contract: #298
Parent: #297
Depends on: #303
Goal
Add tests that protect against behavioral drift between synchronous
Mlbmethods and their asynchronousAsyncMlbequivalents.Contract source
#298 defines the public async contract. These tests should compare externally visible behavior, not require sync and async internals to be architecturally identical.
Scope
For endpoints implemented in both clients, feed equivalent response fixtures through each path and compare:
None,[], and{}behaviorInitial parity coverage must include:
get_teamget_personget_scheduleContract requirements from #298
Equivalent sync/async behavior should include:
Also compare where practical:
MlbHttpErrorstatus code, reason, URL, method, and public response contextMlbHttpCompatibilityWarningcategory and caller-facing behaviorAsync-specific semantics such as
asyncio.CancelledError,aclose(), and concurrent same-client usage belong primarily to #302/#303 and do not need artificial sync equivalents.Constraints
Acceptance criteria
get_team,get_person, andget_schedulehave sync/async parity coverageNone,[], or{}behaviorRefs #297
Contract: #298