Skip to content

Added tests for create_autotest_settings_class - #22

Merged
david-yz-liu merged 1 commit into
mainfrom
settings-class-tests
Nov 1, 2026
Merged

david-yz-liu merged 1 commit into
mainfrom
settings-class-tests

Conversation

@david-yz-liu

Copy link
Copy Markdown
Contributor

Summary

create_autotest_settings_class is the main entry point for building the top-level settings type, but it had no tests in this repo. Calling it with an empty list of tester classes failed with the confusing TypeError: reduce() of empty iterable with no initial value.

  • It now raises ValueError("At least one tester class is required") before building the union, and the docstring mentions this.
  • The tester_classes type hint is narrowed from list[type] to list[type[BaseTesterSettings]].
  • Added tests in tests/test_types/test_core.py covering: decoding a settings document with two tester classes in the union (each entry is decoded as the class matching its tester_type, and _user is decoded); a single tester class; an empty testers list being rejected (min_length=1); an unknown tester_type being rejected; and an empty tester_classes list raising ValueError.
  • Added a changelog entry.

Testing

  • uv sync --locked --all-extras --dev, then uv run pytest -q: 16 passed.
  • uv run ruff check .: All checks passed. uv run ruff format --check .: 7 files already formatted.
  • With the ValueError guard temporarily removed, test_create_autotest_settings_class_no_tester_classes failed with the reduce() TypeError; it passes with the guard restored.

🤖 Generated with Claude Code

create_autotest_settings_class is the main entry point for building the
settings type but had no tests. Calling it with no tester classes failed
with a confusing "reduce() of empty iterable" TypeError; it now raises a
ValueError with a clear message. Also narrowed the tester_classes type
hint to list[type[BaseTesterSettings]].

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@david-yz-liu
david-yz-liu merged commit 2860191 into main Nov 1, 2026
6 checks passed
@david-yz-liu
david-yz-liu deleted the settings-class-tests branch November 1, 2026 17:36
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