Add check_validity function and basic tests (Step 1 of Issue #988)
Hi everyone!
Summary This MR implements Step 1 of Issue #988 (closed) by adding the new function:
pyxel/util/check_validity.py
The function provides generic runtime validation for typed parameters, supporting:
- standard Python types
- Annotated[…]
- annotated_types metadata (Ge, Gt, Le, Lt, Interval)
- Literal[…]
- tuple[…]
- Union / Optional
It raises TypeError for incorrect types and ValueError for invalid values, as required in the issue.
Tests Added: tests/util/test_check_validity_basic.py
Tests cover valid/invalid types, Annotated constraints, Literal, and tuple validation. Please see attached screenshot.
Scope
This MR is self-contained and does not modify existing model behavior.
Further steps (ValueDescriptor integration, YAML validation, extended metadata) will follow in separate MRs.