feat: add expect() and AssertableValue for generic fluent assertions#32
Merged
Conversation
7e92cc0 to
e7f5e3b
Compare
|
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
Adds a generic fluent assertion layer (
expect()/AssertableValue) so the same fluent vocabulary that powersAssertableJson,AssertableHtml,AssertableMCP, etc. extends to any value under test — domain objects, primitives, collections.This is the foundational layer of pyssertive's mission: one fluent vocabulary for everything you test, from a single value to full HTTP responses.
What's new
expect(value)factory +AssertableValueclass with ~30 matchers across:equals,does_not_equal,is_same_as,is_none, ...)is_truthy,is_true,is_false, ...)is_instance_of,is_not_instance_of,is_type)is_greater_than,is_at_least,is_between, ...)has_count,contains,is_empty, ...)has_key,has_attribute, ...)matches,starts_with,ends_with, ...)each(),sequence())from pyssertive import expect, AssertableValue.README improvements (also in this PR)
### Expectationssection at the top of## Usage, framingexpect()as the foundational fluent vocabulary.#### Initialize handshake/#### Tool call — success/#### Tool-level error/#### Protocol error).#### Method catalogwith one sub-table per Assertable (AssertableMCP,AssertableToolList,AssertableToolDef,AssertableToolCall,AssertableContent).MessageBuilderexamples trimmed to 3 prototypical patterns + new flat method catalog table covering all 14 methods (including previously undocumentedlisting_resources/listing_prompts).#### Catalog-wide invariants.### HTTP — Basic Examplemerged into### HTTP Status Assertions(no orphan section).> Requires the Django adapternote added to### Database Assertions.> Breaking change: assert_json()paragraph removed.Test plan
AssertableValuecovering happy + sad paths for every matcher.is_instance_of/is_not_instance_ofcovering single types and tuples.