assertpy 2.35.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- assertpy/__init__.py +87 -0
- assertpy/_clustering.py +511 -0
- assertpy/_dangling.py +505 -0
- assertpy/_engine/__init__.py +1 -0
- assertpy/_engine/_builder_check_typing.py +1365 -0
- assertpy/_engine/_capable_typing.py +772 -0
- assertpy/_engine/_check_typing.py +753 -0
- assertpy/_engine/_compare.py +983 -0
- assertpy/_engine/_compat.py +38 -0
- assertpy/_engine/_contract.py +1926 -0
- assertpy/_engine/_diff.py +1058 -0
- assertpy/_engine/_equality.py +843 -0
- assertpy/_engine/_introspection.py +729 -0
- assertpy/_engine/_membership.py +522 -0
- assertpy/_engine/_mixin_base.py +258 -0
- assertpy/_engine/_negated_typing.py +2176 -0
- assertpy/_engine/_operations.py +75 -0
- assertpy/_engine/_ordering.py +884 -0
- assertpy/_engine/_pairing.py +70 -0
- assertpy/_engine/_path.py +158 -0
- assertpy/_engine/_poll_typing.py +6039 -0
- assertpy/_engine/_require.py +312 -0
- assertpy/_engine/_size.py +31 -0
- assertpy/_engine/_text.py +39 -0
- assertpy/_engine/_typing.py +1226 -0
- assertpy/_hints.py +1213 -0
- assertpy/_inline.py +484 -0
- assertpy/_matcher_impls.py +1876 -0
- assertpy/_passes.py +249 -0
- assertpy/_renamed.py +64 -0
- assertpy/_satisfies.py +835 -0
- assertpy/_snapshot_codec.py +290 -0
- assertpy/assertpy.py +2640 -0
- assertpy/async_assertions.py +864 -0
- assertpy/base.py +862 -0
- assertpy/behave_matchers.py +96 -0
- assertpy/bytes_mixin.py +158 -0
- assertpy/collection.py +528 -0
- assertpy/contains.py +1068 -0
- assertpy/dataframe.py +200 -0
- assertpy/date.py +327 -0
- assertpy/dict.py +249 -0
- assertpy/dynamic.py +222 -0
- assertpy/errors.py +782 -0
- assertpy/exception.py +838 -0
- assertpy/extracting.py +266 -0
- assertpy/file.py +324 -0
- assertpy/helpers.py +747 -0
- assertpy/http_mixin.py +218 -0
- assertpy/json_mixin.py +1265 -0
- assertpy/matchers.py +639 -0
- assertpy/numeric.py +696 -0
- assertpy/outcome.py +163 -0
- assertpy/py.typed +0 -0
- assertpy/pytest_plugin.py +1650 -0
- assertpy/snapshot.py +1031 -0
- assertpy/string.py +803 -0
- assertpy/warning.py +137 -0
- assertpy-2.35.0.dist-info/METADATA +324 -0
- assertpy-2.35.0.dist-info/RECORD +63 -0
- assertpy-2.35.0.dist-info/WHEEL +4 -0
- assertpy-2.35.0.dist-info/entry_points.txt +2 -0
- assertpy-2.35.0.dist-info/licenses/LICENSE +28 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""Which public operations reach a verdict, and what the ones that do not do instead.
|
|
2
|
+
|
|
3
|
+
Both proxies need the same answer. ``not_`` inverts a verdict and ``check()`` reports one, so an
|
|
4
|
+
operation that reaches no verdict means nothing through either, and both used to accept them:
|
|
5
|
+
``assert_that(1).not_.check()`` failed with "Expected <1> to NOT satisfy: check()", and
|
|
6
|
+
``assert_that([1]).check().first()`` answered that an assertion passed when none had run.
|
|
7
|
+
|
|
8
|
+
A verdict is ``self.error(...)``, the one failure entry point every assertion goes through. What is
|
|
9
|
+
registered here is the complement: the operations that reach it through nothing, listed by what they
|
|
10
|
+
do instead. Written as the exceptions rather than as the whole surface, because 134 of the 152 public
|
|
11
|
+
names assert and a register of those would be a second copy of the API, kept in step by hand.
|
|
12
|
+
|
|
13
|
+
`tests/test_operation_contract.py` re-derives this set from the source and fails on any difference, so
|
|
14
|
+
a new operation that asserts nothing cannot quietly become negatable or checkable.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
from typing import Final
|
|
20
|
+
|
|
21
|
+
CONFIGURES: Final = "configures"
|
|
22
|
+
TRANSFORMS: Final = "transforms"
|
|
23
|
+
DESCRIBES: Final = "describes"
|
|
24
|
+
POLLS: Final = "polls"
|
|
25
|
+
|
|
26
|
+
# the proxies word their own sentence: `not_` and `check()` refuse the same operation for different reasons
|
|
27
|
+
WHAT_IT_DOES: Final = {
|
|
28
|
+
CONFIGURES: "only sets an expectation and asserts nothing on its own",
|
|
29
|
+
TRANSFORMS: "hands back a different value instead of asserting",
|
|
30
|
+
DESCRIBES: "only sets the failure description",
|
|
31
|
+
POLLS: "runs a whole chain until it holds",
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
# the builder's own machinery, named rather than filtered, so a new one is declared before the gate takes it
|
|
35
|
+
NOT_AN_OPERATION: Final = frozenset({"builder", "check", "error", "not_", "value"})
|
|
36
|
+
|
|
37
|
+
# the members handing the subject back: no assertion left uncalled for the dangling check, none to wrap for a proxy
|
|
38
|
+
HANDS_THE_SUBJECT_BACK: Final = frozenset({"val", "value"})
|
|
39
|
+
|
|
40
|
+
# the hybrids: named, since "reaches `self.error()`" does not separate a verdict from a precondition
|
|
41
|
+
ALSO_ASSERTS: Final = frozenset(
|
|
42
|
+
{
|
|
43
|
+
"caused_by",
|
|
44
|
+
"error_of",
|
|
45
|
+
"extracting_group",
|
|
46
|
+
"has_root_cause",
|
|
47
|
+
"matches_with_groups",
|
|
48
|
+
"when_called_with",
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
WITHOUT_A_VERDICT: Final[dict[str, str]] = {
|
|
53
|
+
"raises": CONFIGURES,
|
|
54
|
+
"does_not_raise": CONFIGURES,
|
|
55
|
+
"warns": CONFIGURES,
|
|
56
|
+
"does_not_warn": CONFIGURES,
|
|
57
|
+
"at_json_path": TRANSFORMS,
|
|
58
|
+
"decoded_as": TRANSFORMS,
|
|
59
|
+
"decoded_as_json": TRANSFORMS,
|
|
60
|
+
"element": TRANSFORMS,
|
|
61
|
+
"extracting": TRANSFORMS,
|
|
62
|
+
"filtered_on": TRANSFORMS,
|
|
63
|
+
"first": TRANSFORMS,
|
|
64
|
+
"flat_mapped": TRANSFORMS,
|
|
65
|
+
"last": TRANSFORMS,
|
|
66
|
+
"mapped": TRANSFORMS,
|
|
67
|
+
"raised": TRANSFORMS,
|
|
68
|
+
"returned": TRANSFORMS,
|
|
69
|
+
# `errors()` takes no expectation, so once a group is caught there is nothing it can be wrong about
|
|
70
|
+
"errors": TRANSFORMS,
|
|
71
|
+
"single": TRANSFORMS,
|
|
72
|
+
"described_as": DESCRIBES,
|
|
73
|
+
"eventually": POLLS,
|
|
74
|
+
"eventually_sync": POLLS,
|
|
75
|
+
}
|