feat: add expect.* factories + consolidate arch/ module#34
Merged
Conversation
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Two related improvements:
expect.*as unified entry point — thin factory methods onexpectthat wrap the existing constructors. Same fluent style for any subject, lazy imports keepexpectlight.arch/module consolidation — collapses 4 internal files into a singleassertable.py, removing theentrypoint.pyindirection that broke convention with the rest of the library.What's new
Bridge
AssertableJson(...), etc.) remain available — zero breaking changes.from pyssertive import expectstays light.expect.archhas explicit signature (name, optionalcallback) for proper mypy/IDE support._MultiAssertableArch→AssertableMultiArchThe class was already exposed in public type signatures (return type of
assert_arch, callback type) but prefixed with_indicating internal. Renamed to match theAssertable*convention and added to__all__so it's a first-class public type.arch/module consolidationBefore:
```
arch/
├── init.py
├── _chains.py
├── assertable.py (AssertableArch, AssertableMultiArch)
├── entrypoint.py (_AssertArch, assert_arch singleton)
├── graph.py (build_graph)
├── layers.py (AssertableLayers)
└── modules.py (AssertableModules)
```
After:
```
arch/
├── init.py (public re-exports)
├── _chains.py (graph traversal helpers — kept separate)
└── assertable.py (everything Assertable + _AssertArch + assert_arch + build_graph)
```
Why: the rest of the library follows "the Assertable class is the entry point" (cf.
formats/json.py,formats/html.py,protocols/mcp/assertable.py).arch/was the outlier with a separateentrypoint.py. Consolidating restores convention. The_chains.pygraph traversal helpers stay separate (different responsibility —_prefix correctly signals internal).Test plan
tests/test_assertions.py— one perexpect.*entry point, type-check only (behavior covered by the underlying suites).#### Unified entry pointsection in### Expectations.Backward compatibility
100%. No public APIs changed:
AssertableJson(...),AssertableHtml(...),AssertableMCP(...),assert_arch(...)all continue to work.from pyssertive.arch import AssertableArch, assert_arch(the public path) unchanged.from pyssertive.arch.entrypoint import .../from pyssertive.arch.layers import .../ etc. would break, but nothing inside or outside the library used those paths.