Skip to content

new experimental optype.test module#544

Merged
jorenham merged 6 commits into
masterfrom
optype.test
Feb 19, 2026
Merged

new experimental optype.test module#544
jorenham merged 6 commits into
masterfrom
optype.test

Conversation

@jorenham

Copy link
Copy Markdown
Owner

It's type-check only, experimental, and only contains assert_subtype for now.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new experimental optype.test module that provides type-check only utilities for testing static types. The module is stub-only (.pyi file) and is not available at runtime, following the intended design for type-checking utilities. The module currently contains a single utility, assert_subtype, which provides a flexible alternative to typing.assert_type for writing type-tests compatible with multiple type checkers.

Changes:

  • Added new experimental optype.test module with assert_subtype utility for type-checking
  • Updated documentation and configuration to include the new experimental module
  • Added comprehensive tests in stub format to verify the type-checking behavior

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
optype/test.pyi New stub-only module implementing assert_subtype as a generic class with @type_check_only decorator
optype/__init__.pyi Added test module to imports and __all__ list for type-checking support
tests/test_test.pyi Added type-checking tests covering valid subtypes and invalid cases with proper type-ignore annotations
docs/reference/experimental/test.md Added comprehensive documentation explaining the experimental nature, usage, and examples
zensical.toml Added experimental test module to documentation navigation structure
.github/labeler.yml Added labeler configuration for optype.test module (but with incorrect file extension)
Comments suppressed due to low confidence (2)

.github/labeler.yml:88

  • The labeler configuration references optype/test.py, but the module is implemented as optype/test.pyi (a stub-only file). This configuration won't match changes to the actual file. The path should be changed to optype/test.pyi to correctly trigger the label when this file is modified.
optype.test:
  - changed-files:
      - any-glob-to-any-file:
          - optype/test.py

docs/reference/experimental/test.md:38

  • Inconsistent spacing before inline comments. Line 36 has a space before the comment # (1)!, but lines 37-38 lack this space (#(2)! and #(3)!). For consistency, all three lines should have the same spacing convention - either all with a space or all without.
    assert_subtype[int](True) # (1)!
    assert_subtype[int](1) #(2)!
    assert_subtype[int](1.0) #(3)!

@jorenham jorenham merged commit caea921 into master Feb 19, 2026
32 checks passed
@jorenham jorenham deleted the optype.test branch February 19, 2026 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants