Skip to content

Tests for every SDK method and model; five error-handling fixes - #39

Merged
DrAlexHarrison merged 5 commits into
mainfrom
muse/sdk-tests-py
Nov 28, 2026
Merged

DrAlexHarrison merged 5 commits into
mainfrom
muse/sdk-tests-py

Conversation

@DrAlexHarrison

Copy link
Copy Markdown
Member

Tests now cover every public method and model of the Python SDK, against a mocked HTTP layer, and every README and docstring example runs as a test (640 passed, 2 skipped; branch coverage 100%, from 99.3%).

Bug fixes, public API unchanged:

  1. A 200 with a non-JSON or empty body raised json.JSONDecodeError; it now raises SaturdayError with code invalid_response.
  2. Typed 4xx errors always reported retry_after None; every error now carries the Retry-After value.
  3. An empty path segment (athletes.get("")) requested the collection route; it now raises ValueError before any request.
  4. Two docstrings named the builtin PermissionError; the SDK raises PermissionDeniedError.
  5. The README resource table lacked athletes.create_onboarding_link.

Responses for nutrition.extract, infer, knowledge, untyped coach reads, organization subscriptions and licenses, integrations sync and disconnect, GearItem and ProductCategory are built from types.py and marked CONSTRUCTED: they prove request shape, not the live response shape.

Written by Meta Muse Code in a fenced lane; reviewed and tests rerun by Claude (OPS).

🤖 Generated with Claude Code

A 200 with a non-JSON or empty body now raises SaturdayError (code invalid_response) instead of leaking json.JSONDecodeError; Retry-After is kept on typed 4xx errors, not only on 429/5xx; an empty path segment is rejected like dot segments instead of requesting the collection route; two docstrings named PermissionDeniedError, not the builtin PermissionError; the README resource table lists athletes.create_onboarding_link. Each fix has a regression test that failed before it in tests/test_bugfixes.py, and the non-JSON xfail in test_request.py now runs as a passing test.
All nine README python blocks now execute against mocked HTTP with recorded responses (previously two ran and the rest only compiled), as do the package, Saturday and coach docstring examples. The two docstring snippets are fragments that assume the Saturday import, so their tests seed that name.
@DrAlexHarrison
DrAlexHarrison merged commit 74ef2cc into main Nov 28, 2026
1 check passed
@DrAlexHarrison
DrAlexHarrison deleted the muse/sdk-tests-py branch November 28, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant