Formats¶
JSON and HTML assertables. See the JSON and HTML guides for task-focused examples.
pyssertive.formats.AssertableJson ¶
Fluent assertions over a parsed JSON document or a scoped sub-tree.
Created implicitly by FluentResponse.assert_json(). Scoping via
:meth:json returns a new instance bound to a sub-tree of the
already-parsed data — no re-parsing.
All path arguments use dot-notation relative to the current scope
(e.g. "user.profile.age"). Array indices are numeric strings
(e.g. "items.0.id").
Source code in src/pyssertive/formats/json.py
has ¶
Source code in src/pyssertive/formats/json.py
missing ¶
where ¶
Source code in src/pyssertive/formats/json.py
where_not ¶
where_truthy ¶
where_falsy ¶
where_type ¶
Source code in src/pyssertive/formats/json.py
count ¶
Source code in src/pyssertive/formats/json.py
fragment ¶
Source code in src/pyssertive/formats/json.py
missing_fragment ¶
Source code in src/pyssertive/formats/json.py
exact ¶
is_dict ¶
is_list ¶
structure ¶
Source code in src/pyssertive/formats/json.py
matches_schema ¶
Source code in src/pyssertive/formats/json.py
json ¶
json(
path: str,
callback: Callable[[AssertableJson], Any] | None = None,
) -> AssertableJson | Self
Source code in src/pyssertive/formats/json.py
pyssertive.formats.AssertableHtml ¶
Fluent assertions over an HTML document or a scoped sub-tree.
Created implicitly by FluentResponse.assert_html(). Scoping via
:meth:html returns a new instance bound to a sub-tree of the
already-parsed document — no re-parsing.
Two families of content assertions:
see_html/dont_see_html— operate on the raw HTML markup (tags preserved). Use when asserting tag structure, class names, attribute values, or specific HTML fragments.see_text/dont_see_text— operate on the rendered visible text (tags stripped). Use when asserting what a reader would see.
Selector-based assertions (count, exists, missing, html)
use CSS selectors via BeautifulSoup/soupsieve.
Source code in src/pyssertive/formats/html.py
see_html ¶
dont_see_html ¶
see_html_in_order ¶
Source code in src/pyssertive/formats/html.py
see_text ¶
dont_see_text ¶
see_text_in_order ¶
Source code in src/pyssertive/formats/html.py
html_contains ¶
count ¶
Source code in src/pyssertive/formats/html.py
exists ¶
missing ¶
html ¶
html(
selector: str,
callback: Callable[[AssertableHtml], Any] | None = None,
) -> AssertableHtml | Self