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.
Files changed (63) hide show
  1. assertpy/__init__.py +87 -0
  2. assertpy/_clustering.py +511 -0
  3. assertpy/_dangling.py +505 -0
  4. assertpy/_engine/__init__.py +1 -0
  5. assertpy/_engine/_builder_check_typing.py +1365 -0
  6. assertpy/_engine/_capable_typing.py +772 -0
  7. assertpy/_engine/_check_typing.py +753 -0
  8. assertpy/_engine/_compare.py +983 -0
  9. assertpy/_engine/_compat.py +38 -0
  10. assertpy/_engine/_contract.py +1926 -0
  11. assertpy/_engine/_diff.py +1058 -0
  12. assertpy/_engine/_equality.py +843 -0
  13. assertpy/_engine/_introspection.py +729 -0
  14. assertpy/_engine/_membership.py +522 -0
  15. assertpy/_engine/_mixin_base.py +258 -0
  16. assertpy/_engine/_negated_typing.py +2176 -0
  17. assertpy/_engine/_operations.py +75 -0
  18. assertpy/_engine/_ordering.py +884 -0
  19. assertpy/_engine/_pairing.py +70 -0
  20. assertpy/_engine/_path.py +158 -0
  21. assertpy/_engine/_poll_typing.py +6039 -0
  22. assertpy/_engine/_require.py +312 -0
  23. assertpy/_engine/_size.py +31 -0
  24. assertpy/_engine/_text.py +39 -0
  25. assertpy/_engine/_typing.py +1226 -0
  26. assertpy/_hints.py +1213 -0
  27. assertpy/_inline.py +484 -0
  28. assertpy/_matcher_impls.py +1876 -0
  29. assertpy/_passes.py +249 -0
  30. assertpy/_renamed.py +64 -0
  31. assertpy/_satisfies.py +835 -0
  32. assertpy/_snapshot_codec.py +290 -0
  33. assertpy/assertpy.py +2640 -0
  34. assertpy/async_assertions.py +864 -0
  35. assertpy/base.py +862 -0
  36. assertpy/behave_matchers.py +96 -0
  37. assertpy/bytes_mixin.py +158 -0
  38. assertpy/collection.py +528 -0
  39. assertpy/contains.py +1068 -0
  40. assertpy/dataframe.py +200 -0
  41. assertpy/date.py +327 -0
  42. assertpy/dict.py +249 -0
  43. assertpy/dynamic.py +222 -0
  44. assertpy/errors.py +782 -0
  45. assertpy/exception.py +838 -0
  46. assertpy/extracting.py +266 -0
  47. assertpy/file.py +324 -0
  48. assertpy/helpers.py +747 -0
  49. assertpy/http_mixin.py +218 -0
  50. assertpy/json_mixin.py +1265 -0
  51. assertpy/matchers.py +639 -0
  52. assertpy/numeric.py +696 -0
  53. assertpy/outcome.py +163 -0
  54. assertpy/py.typed +0 -0
  55. assertpy/pytest_plugin.py +1650 -0
  56. assertpy/snapshot.py +1031 -0
  57. assertpy/string.py +803 -0
  58. assertpy/warning.py +137 -0
  59. assertpy-2.35.0.dist-info/METADATA +324 -0
  60. assertpy-2.35.0.dist-info/RECORD +63 -0
  61. assertpy-2.35.0.dist-info/WHEEL +4 -0
  62. assertpy-2.35.0.dist-info/entry_points.txt +2 -0
  63. assertpy-2.35.0.dist-info/licenses/LICENSE +28 -0
@@ -0,0 +1,753 @@
1
+ """The verdict twin of every assertion protocol, generated by `scripts/generate_check_protocols.py`.
2
+
3
+ Do not edit. `check()` hands back the twin of the view it was reached from, so an assertion asked for
4
+ a verdict is checked against the same value type it would be checked against normally:
5
+ `assert_that(1).check().starts_with("x")` is a type error rather than a runtime one.
6
+
7
+ Only operations that reach a verdict appear. A pivot or a configurer has none to report, and both
8
+ proxies refuse them at runtime; see `assertpy/_engine/_operations.py`.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ from typing import TYPE_CHECKING
14
+
15
+ if TYPE_CHECKING:
16
+ import datetime
17
+ import re
18
+ from collections.abc import Callable, Hashable, Iterable, Mapping, Sized
19
+ from pathlib import Path
20
+ from typing import Any, Protocol, SupportsFloat, SupportsIndex, TypeVar, overload
21
+
22
+ from typing_extensions import TypeIs
23
+
24
+ from .._matcher_impls import ClassInfo, ExceptionInfo
25
+ from ..errors import AssertionOutcome
26
+ from ..matchers import Matcher
27
+ from ._compat import Self
28
+ from ._introspection import MappingLike
29
+
30
+ # the type variables come from the module these twins mirror, so the two cannot disagree about a binding
31
+ from ._typing import (
32
+ _U,
33
+ _ArrayT_co,
34
+ _CapableT,
35
+ _FrameT_co,
36
+ _Holding,
37
+ _Landed,
38
+ _ObjectAssertion,
39
+ _Other,
40
+ _P_co,
41
+ _T_co,
42
+ )
43
+
44
+ _KeySpecs = Hashable | list[Hashable] | set[Hashable] | frozenset[Hashable]
45
+
46
+ _E = TypeVar("_E")
47
+ # a verdict reads no exception back, so the twin's is covariant where the view's is not
48
+ _Exc_co = TypeVar("_Exc_co", bound=BaseException, covariant=True)
49
+ _N = TypeVar("_N", int, float)
50
+ _K = TypeVar("_K")
51
+ _V = TypeVar("_V")
52
+ _B_co = TypeVar("_B_co", bytes, bytearray, covariant=True)
53
+ _U2 = TypeVar("_U2")
54
+ _U3 = TypeVar("_U3")
55
+ _Number = SupportsFloat
56
+
57
+ class _CheckMembershipAssertion(Protocol):
58
+ """The verdict twin of `_MembershipAssertion`."""
59
+
60
+ def is_subset_of(self, *supersets: object, allow_empty: bool = ...) -> AssertionOutcome: ...
61
+ @property
62
+ def not_(self) -> Self: ...
63
+
64
+ class _CheckSizedAssertion(Protocol):
65
+ """The verdict twin of `_SizedAssertion`."""
66
+
67
+ def has_same_size_as(self, other: Sized) -> AssertionOutcome: ...
68
+ def has_size_greater_than(self, size: SupportsIndex) -> AssertionOutcome: ...
69
+ def has_size_less_than(self, size: SupportsIndex) -> AssertionOutcome: ...
70
+ def has_size_between(self, low: SupportsIndex, high: SupportsIndex) -> AssertionOutcome: ...
71
+ def is_empty(self) -> AssertionOutcome: ...
72
+ def is_not_empty(self) -> AssertionOutcome: ...
73
+ @property
74
+ def not_(self) -> Self: ...
75
+
76
+ class _CheckFilesystemAssertion(Protocol):
77
+ """The verdict twin of `_FilesystemAssertion`."""
78
+
79
+ def exists(self) -> AssertionOutcome: ...
80
+ def does_not_exist(self) -> AssertionOutcome: ...
81
+ def is_file(self) -> AssertionOutcome: ...
82
+ def is_directory(self) -> AssertionOutcome: ...
83
+ def is_named(self, filename: str) -> AssertionOutcome: ...
84
+ def is_child_of(self, parent: object) -> AssertionOutcome: ...
85
+ def is_readable(self) -> AssertionOutcome: ...
86
+ def is_writable(self) -> AssertionOutcome: ...
87
+ def is_executable(self) -> AssertionOutcome: ...
88
+ @property
89
+ def not_(self) -> Self: ...
90
+
91
+ class _CheckRealNumberAssertion(Protocol):
92
+ """The verdict twin of `_RealNumberAssertion`."""
93
+
94
+ def is_positive(self) -> AssertionOutcome: ...
95
+ def is_negative(self) -> AssertionOutcome: ...
96
+ def is_nan(self) -> AssertionOutcome: ...
97
+ def is_not_nan(self) -> AssertionOutcome: ...
98
+ def is_inf(self) -> AssertionOutcome: ...
99
+ def is_not_inf(self) -> AssertionOutcome: ...
100
+ def is_not_between(self, low: _Number, high: _Number) -> AssertionOutcome: ...
101
+ def is_between(self, low: _Number, high: _Number) -> AssertionOutcome: ...
102
+ def is_greater_than(self, other: _Number) -> AssertionOutcome: ...
103
+ def is_greater_than_or_equal_to(self, other: _Number) -> AssertionOutcome: ...
104
+ def is_less_than(self, other: _Number) -> AssertionOutcome: ...
105
+ def is_less_than_or_equal_to(self, other: _Number) -> AssertionOutcome: ...
106
+ @property
107
+ def not_(self) -> Self: ...
108
+
109
+ class _CheckWalkAssertion(Protocol):
110
+ """The verdict twin of `_WalkAssertion`."""
111
+
112
+ def each(
113
+ self, matcher: Matcher[Any] | Callable[[Any], object], *, allow_empty: bool = ...
114
+ ) -> AssertionOutcome: ...
115
+ def all_satisfy(
116
+ self, matcher: Matcher[Any] | Callable[[Any], object], *, allow_empty: bool = ...
117
+ ) -> AssertionOutcome: ...
118
+ @property
119
+ def not_(self) -> Self: ...
120
+
121
+ class _CheckJsonAssertion(Protocol):
122
+ """The verdict twin of `_JsonAssertion`."""
123
+
124
+ def has_json_path(self, path: str) -> AssertionOutcome: ...
125
+ def does_not_have_json_path(self, path: str) -> AssertionOutcome: ...
126
+ def matches_json_schema(self, schema: dict[str, Any]) -> AssertionOutcome: ...
127
+ def matches_json_schema_from_file(self, path: str | Path) -> AssertionOutcome: ...
128
+ def conforms_to_openapi(
129
+ self,
130
+ spec: dict[str, Any],
131
+ path: str,
132
+ method: str,
133
+ *,
134
+ status: str | int | None = ...,
135
+ content_type: str = ...,
136
+ strict_nullable: bool = ...,
137
+ ) -> AssertionOutcome: ...
138
+ @property
139
+ def not_(self) -> Self: ...
140
+
141
+ class _CheckStructureAssertion(_CheckWalkAssertion, _CheckJsonAssertion, Protocol):
142
+ """The verdict twin of `_StructureAssertion`."""
143
+
144
+ @property
145
+ def not_(self) -> Self: ...
146
+
147
+ class _CheckRepeatableAssertion(Protocol[_E]):
148
+ """The verdict twin of `_RepeatableAssertion`."""
149
+
150
+ def contains_duplicates(self) -> AssertionOutcome: ...
151
+ def does_not_contain_duplicates(self) -> AssertionOutcome: ...
152
+ def contains_only_once(self, *items: object) -> AssertionOutcome: ...
153
+ def contains_in_order(self, *items: _E | Matcher[_E]) -> AssertionOutcome: ...
154
+ @property
155
+ def not_(self) -> Self: ...
156
+
157
+ class _CheckZeroAssertion(Protocol):
158
+ """The verdict twin of `_ZeroAssertion`."""
159
+
160
+ def is_zero(self) -> AssertionOutcome: ...
161
+ def is_not_zero(self) -> AssertionOutcome: ...
162
+ @property
163
+ def not_(self) -> Self: ...
164
+
165
+ class _CheckCoreAssertion(Protocol):
166
+ """The verdict twin of `_CoreAssertion`."""
167
+
168
+ def is_equal_to(
169
+ self,
170
+ other: object,
171
+ *,
172
+ ignore: _KeySpecs | None = ...,
173
+ include: _KeySpecs | None = ...,
174
+ tolerance: float | None = ...,
175
+ rel: float | None = ...,
176
+ comparators: dict[Any, Callable[[Any, Any], Any]] | None = ...,
177
+ ignore_null: bool = ...,
178
+ strict_types: bool = ...,
179
+ ) -> AssertionOutcome: ...
180
+ def is_not_equal_to(self, other: object) -> AssertionOutcome: ...
181
+ def is_same_as(self, other: object) -> AssertionOutcome: ...
182
+ def is_not_same_as(self, other: object) -> AssertionOutcome: ...
183
+ def is_true(self) -> AssertionOutcome: ...
184
+ def is_false(self) -> AssertionOutcome: ...
185
+ def is_none(self) -> AssertionOutcome: ...
186
+ def is_not_none(self) -> AssertionOutcome: ...
187
+ def is_type_of(self, some_type: type) -> AssertionOutcome: ...
188
+ def is_instance_of(self, some_class: ClassInfo) -> AssertionOutcome: ...
189
+ def is_instance_of_any(self, *some_classes: ClassInfo) -> AssertionOutcome: ...
190
+ def is_subclass_of(self, some_class: ClassInfo) -> AssertionOutcome: ...
191
+ def is_length(self, length: SupportsIndex | Matcher[int]) -> AssertionOutcome: ...
192
+ def is_length_between(self, low: SupportsIndex, high: SupportsIndex) -> AssertionOutcome: ...
193
+ def is_callable(self) -> AssertionOutcome: ...
194
+ def is_not_callable(self) -> AssertionOutcome: ...
195
+ def is_iterable(self) -> AssertionOutcome: ...
196
+ def is_not_iterable(self) -> AssertionOutcome: ...
197
+ @overload
198
+ def satisfies(self, matcher: Callable[[Any], TypeIs[str]]) -> AssertionOutcome: ...
199
+ @overload
200
+ def satisfies(self, matcher: Callable[[Any], TypeIs[bool]]) -> AssertionOutcome: ...
201
+ @overload
202
+ def satisfies(self, matcher: Callable[[Any], TypeIs[int]]) -> AssertionOutcome: ...
203
+ @overload
204
+ def satisfies(self, matcher: Callable[[Any], TypeIs[float]]) -> AssertionOutcome: ...
205
+ @overload
206
+ def satisfies(self, matcher: Callable[[Any], TypeIs[complex]]) -> AssertionOutcome: ...
207
+ @overload
208
+ def satisfies(self, matcher: Callable[[Any], TypeIs[dict[_K, _V]]]) -> AssertionOutcome: ...
209
+ @overload
210
+ def satisfies(self, matcher: Callable[[Any], TypeIs[list[_E] | tuple[_E, ...]]]) -> AssertionOutcome: ...
211
+ @overload
212
+ def satisfies(self, matcher: Callable[[Any], TypeIs[set[_E] | frozenset[_E]]]) -> AssertionOutcome: ...
213
+ @overload
214
+ def satisfies(self, matcher: Callable[[Any], TypeIs[datetime.datetime]]) -> AssertionOutcome: ...
215
+ @overload
216
+ def satisfies(self, matcher: Callable[[Any], TypeIs[datetime.date]]) -> AssertionOutcome: ...
217
+ @overload
218
+ def satisfies(self, matcher: Callable[[Any], TypeIs[Path]]) -> AssertionOutcome: ...
219
+ @overload
220
+ def satisfies(self, matcher: Callable[[Any], TypeIs[bytes]]) -> AssertionOutcome: ...
221
+ @overload
222
+ def satisfies(self, matcher: Callable[[Any], TypeIs[bytearray]]) -> AssertionOutcome: ...
223
+ @overload
224
+ def satisfies(self, matcher: Callable[[Any], TypeIs[Callable[..., object]]]) -> AssertionOutcome: ...
225
+ @overload
226
+ def satisfies(self, matcher: Callable[[Any], TypeIs[_CapableT]]) -> AssertionOutcome: ...
227
+ @overload
228
+ def satisfies(self, matcher: Callable[[Any], TypeIs[_U]]) -> AssertionOutcome: ...
229
+ @overload
230
+ def satisfies(self, matcher: Matcher[Any] | Callable[[Any], object]) -> AssertionOutcome: ...
231
+ def all_fields_satisfy(
232
+ self, matcher: Matcher[Any] | Callable[[Any], object], *, allow_empty: bool = ...
233
+ ) -> AssertionOutcome: ...
234
+ def has_no_none_fields(self, *, allow_empty: bool = ...) -> AssertionOutcome: ...
235
+ def is_in(self, *items: object) -> AssertionOutcome: ...
236
+ def is_not_in(self, *items: object) -> AssertionOutcome: ...
237
+ def snapshot(
238
+ self,
239
+ id: str | None = ...,
240
+ path: str = ...,
241
+ *,
242
+ ignore: _KeySpecs | None = ...,
243
+ include: _KeySpecs | None = ...,
244
+ tolerance: float | None = ...,
245
+ rel: float | None = ...,
246
+ comparators: dict[Any, Callable[[Any, Any], Any]] | None = ...,
247
+ placeholders: Mapping[Any, Matcher[Any] | Callable[[Any], object]] | None = ...,
248
+ ) -> AssertionOutcome: ...
249
+ def matches_contract_snapshot(self, id: str | None = ..., path: str = ...) -> AssertionOutcome: ...
250
+ def matches_inline(
251
+ self,
252
+ expected: object = ...,
253
+ *,
254
+ ignore: _KeySpecs | None = ...,
255
+ include: _KeySpecs | None = ...,
256
+ tolerance: float | None = ...,
257
+ rel: float | None = ...,
258
+ comparators: dict[Any, Callable[[Any, Any], Any]] | None = ...,
259
+ placeholders: Mapping[Any, Matcher[Any] | Callable[[Any], object]] | None = ...,
260
+ ) -> AssertionOutcome: ...
261
+ @property
262
+ def not_(self) -> Self: ...
263
+
264
+ class _CheckObjectAssertion(_CheckCoreAssertion, Protocol[_T_co]):
265
+ """The verdict twin of `_ObjectAssertion`."""
266
+
267
+ def matches_structure(self, spec: dict[Any, Any]) -> AssertionOutcome: ...
268
+ def is_greater_than(self, other: Any) -> AssertionOutcome: ...
269
+ def is_greater_than_or_equal_to(self, other: Any) -> AssertionOutcome: ...
270
+ def is_less_than(self, other: Any) -> AssertionOutcome: ...
271
+ def is_less_than_or_equal_to(self, other: Any) -> AssertionOutcome: ...
272
+ def is_between(self, low: Any, high: Any) -> AssertionOutcome: ...
273
+ def is_not_between(self, low: Any, high: Any) -> AssertionOutcome: ...
274
+ def is_zero(self: _ObjectAssertion[SupportsFloat | SupportsIndex]) -> AssertionOutcome: ...
275
+ def is_not_zero(self: _ObjectAssertion[SupportsFloat | SupportsIndex]) -> AssertionOutcome: ...
276
+ def is_close_to(
277
+ self: _ObjectAssertion[SupportsFloat | SupportsIndex],
278
+ other: SupportsFloat | SupportsIndex,
279
+ tolerance: SupportsFloat | SupportsIndex | None = ...,
280
+ *,
281
+ rel: SupportsFloat | SupportsIndex | None = ...,
282
+ ) -> AssertionOutcome: ...
283
+ def is_not_close_to(
284
+ self: _ObjectAssertion[SupportsFloat | SupportsIndex],
285
+ other: SupportsFloat | SupportsIndex,
286
+ tolerance: SupportsFloat | SupportsIndex | None = ...,
287
+ *,
288
+ rel: SupportsFloat | SupportsIndex | None = ...,
289
+ ) -> AssertionOutcome: ...
290
+ @overload
291
+ def is_not_none(self: _Holding[str | None]) -> AssertionOutcome: ...
292
+ @overload
293
+ def is_not_none(self: _Holding[bool | None]) -> AssertionOutcome: ...
294
+ @overload
295
+ def is_not_none(self: _Holding[int | None]) -> AssertionOutcome: ...
296
+ @overload
297
+ def is_not_none(self: _Holding[float | None]) -> AssertionOutcome: ...
298
+ @overload
299
+ def is_not_none(self: _Holding[complex | None]) -> AssertionOutcome: ...
300
+ @overload
301
+ def is_not_none(self: _Holding[dict[_K, _V] | None]) -> AssertionOutcome: ...
302
+ @overload
303
+ def is_not_none(self: _Holding[list[_E] | tuple[_E, ...] | None]) -> AssertionOutcome: ...
304
+ @overload
305
+ def is_not_none(self: _Holding[set[_E] | frozenset[_E] | None]) -> AssertionOutcome: ...
306
+ @overload
307
+ def is_not_none(self: _Holding[datetime.datetime | None]) -> AssertionOutcome: ...
308
+ @overload
309
+ def is_not_none(self: _Holding[datetime.date | None]) -> AssertionOutcome: ...
310
+ @overload
311
+ def is_not_none(self: _Holding[Path | None]) -> AssertionOutcome: ...
312
+ @overload
313
+ def is_not_none(self: _Holding[bytes | None]) -> AssertionOutcome: ...
314
+ @overload
315
+ def is_not_none(self: _Holding[bytearray | None]) -> AssertionOutcome: ...
316
+ @overload
317
+ def is_not_none(self: _Holding[Callable[..., object] | None]) -> AssertionOutcome: ...
318
+ @overload
319
+ def is_not_none(self: _Holding[_U | None]) -> AssertionOutcome: ...
320
+ @overload
321
+ def is_not_none(self) -> AssertionOutcome: ...
322
+ @overload
323
+ def is_instance_of(self, some_class: type[str]) -> AssertionOutcome: ...
324
+ @overload
325
+ def is_instance_of(self, some_class: type[bool]) -> AssertionOutcome: ...
326
+ @overload
327
+ def is_instance_of(self, some_class: type[int]) -> AssertionOutcome: ...
328
+ @overload
329
+ def is_instance_of(self, some_class: type[float]) -> AssertionOutcome: ...
330
+ @overload
331
+ def is_instance_of(self, some_class: type[complex]) -> AssertionOutcome: ...
332
+ @overload
333
+ def is_instance_of(self, some_class: type[dict[_K, _V]]) -> AssertionOutcome: ...
334
+ @overload
335
+ def is_instance_of(self, some_class: type[list[_E] | tuple[_E, ...]]) -> AssertionOutcome: ...
336
+ @overload
337
+ def is_instance_of(self, some_class: type[set[_E] | frozenset[_E]]) -> AssertionOutcome: ...
338
+ @overload
339
+ def is_instance_of(self, some_class: type[datetime.datetime]) -> AssertionOutcome: ...
340
+ @overload
341
+ def is_instance_of(self, some_class: type[datetime.date]) -> AssertionOutcome: ...
342
+ @overload
343
+ def is_instance_of(self, some_class: type[Path]) -> AssertionOutcome: ...
344
+ @overload
345
+ def is_instance_of(self, some_class: type[bytes]) -> AssertionOutcome: ...
346
+ @overload
347
+ def is_instance_of(self, some_class: type[bytearray]) -> AssertionOutcome: ...
348
+ @overload
349
+ def is_instance_of(self, some_class: tuple[type[_U], type[_U2]]) -> AssertionOutcome: ...
350
+ @overload
351
+ def is_instance_of(self, some_class: tuple[type[_U], type[_U2], type[_U3]]) -> AssertionOutcome: ...
352
+ @overload
353
+ def is_instance_of(self, some_class: type[_U]) -> AssertionOutcome: ...
354
+ @overload
355
+ def is_instance_of(self, some_class: ClassInfo) -> AssertionOutcome: ...
356
+ @overload
357
+ def is_instance_of_any(self, first: type[_U], second: type[_U2], /) -> AssertionOutcome: ...
358
+ @overload
359
+ def is_instance_of_any(self, first: type[_U], second: type[_U2], third: type[_U3], /) -> AssertionOutcome: ...
360
+ @overload
361
+ def is_instance_of_any(self, *some_classes: ClassInfo) -> AssertionOutcome: ...
362
+ @property
363
+ def not_(self) -> Self: ...
364
+
365
+ class _CheckTextAssertion(
366
+ _CheckMembershipAssertion, _CheckRepeatableAssertion[str], _CheckSizedAssertion, _CheckCoreAssertion, Protocol
367
+ ):
368
+ """The verdict twin of `_TextAssertion`."""
369
+
370
+ @overload
371
+ def satisfies(self, matcher: Callable[[str], TypeIs[str]]) -> AssertionOutcome: ...
372
+ @overload
373
+ def satisfies(self, matcher: Callable[[str], TypeIs[bool]]) -> AssertionOutcome: ...
374
+ @overload
375
+ def satisfies(self, matcher: Callable[[str], TypeIs[int]]) -> AssertionOutcome: ...
376
+ @overload
377
+ def satisfies(self, matcher: Callable[[str], TypeIs[float]]) -> AssertionOutcome: ...
378
+ @overload
379
+ def satisfies(self, matcher: Callable[[str], TypeIs[complex]]) -> AssertionOutcome: ...
380
+ @overload
381
+ def satisfies(self, matcher: Callable[[str], TypeIs[dict[_K, _V]]]) -> AssertionOutcome: ...
382
+ @overload
383
+ def satisfies(self, matcher: Callable[[str], TypeIs[list[_E] | tuple[_E, ...]]]) -> AssertionOutcome: ...
384
+ @overload
385
+ def satisfies(self, matcher: Callable[[str], TypeIs[set[_E] | frozenset[_E]]]) -> AssertionOutcome: ...
386
+ @overload
387
+ def satisfies(self, matcher: Callable[[str], TypeIs[datetime.datetime]]) -> AssertionOutcome: ...
388
+ @overload
389
+ def satisfies(self, matcher: Callable[[str], TypeIs[datetime.date]]) -> AssertionOutcome: ...
390
+ @overload
391
+ def satisfies(self, matcher: Callable[[str], TypeIs[Path]]) -> AssertionOutcome: ...
392
+ @overload
393
+ def satisfies(self, matcher: Callable[[str], TypeIs[bytes]]) -> AssertionOutcome: ...
394
+ @overload
395
+ def satisfies(self, matcher: Callable[[str], TypeIs[bytearray]]) -> AssertionOutcome: ...
396
+ @overload
397
+ def satisfies(self, matcher: Callable[[str], TypeIs[Callable[..., object]]]) -> AssertionOutcome: ...
398
+ @overload
399
+ def satisfies(self, matcher: Callable[[str], TypeIs[_CapableT]]) -> AssertionOutcome: ...
400
+ @overload
401
+ def satisfies(self, matcher: Callable[[str], TypeIs[_U]]) -> AssertionOutcome: ...
402
+ @overload
403
+ def satisfies(self, matcher: Matcher[str] | Callable[[str], object]) -> AssertionOutcome: ...
404
+ def contains(self, *items: str | Matcher[str]) -> AssertionOutcome: ...
405
+ def is_equal_to_ignoring_case(self, other: str) -> AssertionOutcome: ...
406
+ def is_equal_to_ignoring_whitespace(self, other: str) -> AssertionOutcome: ...
407
+ def contains_ignoring_case(self, *items: str) -> AssertionOutcome: ...
408
+ def starts_with(self, prefix: str) -> AssertionOutcome: ...
409
+ def starts_with_ignoring_case(self, prefix: str) -> AssertionOutcome: ...
410
+ def ends_with(self, suffix: str) -> AssertionOutcome: ...
411
+ def ends_with_ignoring_case(self, suffix: str) -> AssertionOutcome: ...
412
+ def matches(self, pattern: str | re.Pattern[str]) -> AssertionOutcome: ...
413
+ def does_not_match(self, pattern: str | re.Pattern[str]) -> AssertionOutcome: ...
414
+ def is_alpha(self) -> AssertionOutcome: ...
415
+ def is_digit(self) -> AssertionOutcome: ...
416
+ def is_lower(self) -> AssertionOutcome: ...
417
+ def is_upper(self) -> AssertionOutcome: ...
418
+ def is_alphanumeric(self) -> AssertionOutcome: ...
419
+ def is_whitespace(self) -> AssertionOutcome: ...
420
+ def contains_any_of(self, *items: str) -> AssertionOutcome: ...
421
+ def contains_none_of(self, *items: str) -> AssertionOutcome: ...
422
+ def is_unicode(self) -> AssertionOutcome: ...
423
+ def is_greater_than(self, other: str) -> AssertionOutcome: ...
424
+ def is_greater_than_or_equal_to(self, other: str) -> AssertionOutcome: ...
425
+ def is_less_than(self, other: str) -> AssertionOutcome: ...
426
+ def is_less_than_or_equal_to(self, other: str) -> AssertionOutcome: ...
427
+ def does_not_contain(self, *items: str | Matcher[str]) -> AssertionOutcome: ...
428
+ def contains_only(self, *items: str | Matcher[str]) -> AssertionOutcome: ...
429
+ def contains_sequence(self, *items: str | Matcher[str]) -> AssertionOutcome: ...
430
+ def contains_exactly(self, *items: str | Matcher[str]) -> AssertionOutcome: ...
431
+ def contains_exactly_in_any_order(self, *items: str | Matcher[str]) -> AssertionOutcome: ...
432
+ def is_sorted(
433
+ self, key: Callable[[str], object] = ..., reverse: bool = ..., *, allow_empty: bool = ...
434
+ ) -> AssertionOutcome: ...
435
+ def each(
436
+ self, matcher: Matcher[str] | Callable[[str], object], *, allow_empty: bool = ...
437
+ ) -> AssertionOutcome: ...
438
+ def all_satisfy(
439
+ self, matcher: Matcher[str] | Callable[[str], object], *, allow_empty: bool = ...
440
+ ) -> AssertionOutcome: ...
441
+ def any_satisfy(self, matcher: Matcher[str] | Callable[[str], object]) -> AssertionOutcome: ...
442
+ def none_satisfy(self, matcher: Matcher[str] | Callable[[str], object]) -> AssertionOutcome: ...
443
+ def satisfies_exactly(self, *matchers: Matcher[str] | Callable[[str], object]) -> AssertionOutcome: ...
444
+ def satisfies_exactly_in_any_order(
445
+ self, *matchers: Matcher[str] | Callable[[str], object]
446
+ ) -> AssertionOutcome: ...
447
+ def zip_satisfies(
448
+ self, other: Iterable[_Other], predicate: Callable[[str, _Other], object], *, allow_empty: bool = ...
449
+ ) -> AssertionOutcome: ...
450
+ def extracting_group(self, pattern: str | re.Pattern[str], group: int | str = ...) -> AssertionOutcome: ...
451
+ def matches_with_groups(self, pattern: str | re.Pattern[str]) -> AssertionOutcome: ...
452
+ @property
453
+ def not_(self) -> Self: ...
454
+
455
+ class _CheckStringAssertion(_CheckTextAssertion, _CheckFilesystemAssertion, Protocol):
456
+ """The verdict twin of `_StringAssertion`."""
457
+
458
+ @property
459
+ def not_(self) -> Self: ...
460
+
461
+ class _CheckNumericAssertion(_CheckRealNumberAssertion, _CheckZeroAssertion, _CheckCoreAssertion, Protocol[_N]):
462
+ """The verdict twin of `_NumericAssertion`."""
463
+
464
+ def is_close_to(
465
+ self, other: _Number, tolerance: _Number | None = ..., *, rel: _Number | None = ...
466
+ ) -> AssertionOutcome: ...
467
+ def is_not_close_to(
468
+ self, other: _Number, tolerance: _Number | None = ..., *, rel: _Number | None = ...
469
+ ) -> AssertionOutcome: ...
470
+ @overload
471
+ def satisfies(self, matcher: Callable[[_N], TypeIs[str]]) -> AssertionOutcome: ...
472
+ @overload
473
+ def satisfies(self, matcher: Callable[[_N], TypeIs[bool]]) -> AssertionOutcome: ...
474
+ @overload
475
+ def satisfies(self, matcher: Callable[[_N], TypeIs[int]]) -> AssertionOutcome: ...
476
+ @overload
477
+ def satisfies(self, matcher: Callable[[_N], TypeIs[float]]) -> AssertionOutcome: ...
478
+ @overload
479
+ def satisfies(self, matcher: Callable[[_N], TypeIs[complex]]) -> AssertionOutcome: ...
480
+ @overload
481
+ def satisfies(self, matcher: Callable[[_N], TypeIs[dict[_K, _V]]]) -> AssertionOutcome: ...
482
+ @overload
483
+ def satisfies(self, matcher: Callable[[_N], TypeIs[list[_E] | tuple[_E, ...]]]) -> AssertionOutcome: ...
484
+ @overload
485
+ def satisfies(self, matcher: Callable[[_N], TypeIs[set[_E] | frozenset[_E]]]) -> AssertionOutcome: ...
486
+ @overload
487
+ def satisfies(self, matcher: Callable[[_N], TypeIs[datetime.datetime]]) -> AssertionOutcome: ...
488
+ @overload
489
+ def satisfies(self, matcher: Callable[[_N], TypeIs[datetime.date]]) -> AssertionOutcome: ...
490
+ @overload
491
+ def satisfies(self, matcher: Callable[[_N], TypeIs[Path]]) -> AssertionOutcome: ...
492
+ @overload
493
+ def satisfies(self, matcher: Callable[[_N], TypeIs[bytes]]) -> AssertionOutcome: ...
494
+ @overload
495
+ def satisfies(self, matcher: Callable[[_N], TypeIs[bytearray]]) -> AssertionOutcome: ...
496
+ @overload
497
+ def satisfies(self, matcher: Callable[[_N], TypeIs[Callable[..., object]]]) -> AssertionOutcome: ...
498
+ @overload
499
+ def satisfies(self, matcher: Callable[[_N], TypeIs[_CapableT]]) -> AssertionOutcome: ...
500
+ @overload
501
+ def satisfies(self, matcher: Callable[[_N], TypeIs[_U]]) -> AssertionOutcome: ...
502
+ @overload
503
+ def satisfies(self, matcher: Matcher[_N] | Callable[[_N], object]) -> AssertionOutcome: ...
504
+ def is_even(self) -> AssertionOutcome: ...
505
+ def is_odd(self) -> AssertionOutcome: ...
506
+ def is_divisible_by(self, divisor: SupportsIndex) -> AssertionOutcome: ...
507
+ @property
508
+ def not_(self) -> Self: ...
509
+
510
+ class _CheckComplexAssertion(_CheckZeroAssertion, _CheckCoreAssertion, Protocol):
511
+ """The verdict twin of `_ComplexAssertion`."""
512
+
513
+ @property
514
+ def not_(self) -> Self: ...
515
+
516
+ class _CheckBoolAssertion(_CheckRealNumberAssertion, _CheckZeroAssertion, _CheckCoreAssertion, Protocol):
517
+ """The verdict twin of `_BoolAssertion`."""
518
+
519
+ @property
520
+ def not_(self) -> Self: ...
521
+
522
+ class _CheckIterableAssertion(
523
+ _CheckMembershipAssertion,
524
+ _CheckStructureAssertion,
525
+ _CheckRepeatableAssertion[_E],
526
+ _CheckSizedAssertion,
527
+ _CheckCoreAssertion,
528
+ Protocol[_E],
529
+ ):
530
+ """The verdict twin of `_IterableAssertion`."""
531
+
532
+ def contains(self, *items: _E | Matcher[_E]) -> AssertionOutcome: ...
533
+ def does_not_contain(self, *items: _E | Matcher[_E]) -> AssertionOutcome: ...
534
+ def contains_only(self, *items: _E | Matcher[_E]) -> AssertionOutcome: ...
535
+ def contains_sequence(self, *items: _E | Matcher[_E]) -> AssertionOutcome: ...
536
+ def contains_exactly(self, *items: _E | Matcher[_E]) -> AssertionOutcome: ...
537
+ def contains_exactly_in_any_order(self, *items: _E | Matcher[_E]) -> AssertionOutcome: ...
538
+ def is_sorted(
539
+ self, key: Callable[[_E], object] = ..., reverse: bool = ..., *, allow_empty: bool = ...
540
+ ) -> AssertionOutcome: ...
541
+ def starts_with(self, prefix: _E) -> AssertionOutcome: ...
542
+ def ends_with(self, suffix: _E) -> AssertionOutcome: ...
543
+ def each(
544
+ self, matcher: Matcher[_E] | Callable[[_E], object], *, allow_empty: bool = ...
545
+ ) -> AssertionOutcome: ...
546
+ def all_satisfy(
547
+ self, matcher: Matcher[_E] | Callable[[_E], object], *, allow_empty: bool = ...
548
+ ) -> AssertionOutcome: ...
549
+ def any_satisfy(self, matcher: Matcher[_E] | Callable[[_E], object]) -> AssertionOutcome: ...
550
+ def none_satisfy(self, matcher: Matcher[_E] | Callable[[_E], object]) -> AssertionOutcome: ...
551
+ def satisfies_exactly(self, *matchers: Matcher[_E] | Callable[[_E], object]) -> AssertionOutcome: ...
552
+ def satisfies_exactly_in_any_order(
553
+ self, *matchers: Matcher[_E] | Callable[[_E], object]
554
+ ) -> AssertionOutcome: ...
555
+ def zip_satisfies(
556
+ self, other: Iterable[_Other], predicate: Callable[[_E, _Other], object], *, allow_empty: bool = ...
557
+ ) -> AssertionOutcome: ...
558
+ @property
559
+ def not_(self) -> Self: ...
560
+
561
+ class _CheckListAssertion(_CheckIterableAssertion[_E], Protocol[_E]):
562
+ """The verdict twin of `_ListAssertion`."""
563
+
564
+ @property
565
+ def not_(self) -> Self: ...
566
+
567
+ class _CheckDictAssertion(_CheckStructureAssertion, _CheckSizedAssertion, _CheckCoreAssertion, Protocol[_K, _V]):
568
+ """The verdict twin of `_DictAssertion`."""
569
+
570
+ def is_subset_of(
571
+ self, *supersets: Mapping[Any, Any] | MappingLike, allow_empty: bool = ...
572
+ ) -> AssertionOutcome: ...
573
+ def contains(self, *items: object) -> AssertionOutcome: ...
574
+ def each(
575
+ self, matcher: Matcher[_K] | Callable[[_K], object], *, allow_empty: bool = ...
576
+ ) -> AssertionOutcome: ...
577
+ def all_satisfy(
578
+ self, matcher: Matcher[_K] | Callable[[_K], object], *, allow_empty: bool = ...
579
+ ) -> AssertionOutcome: ...
580
+ def contains_key(self, *keys: _K | Matcher[_K]) -> AssertionOutcome: ...
581
+ def does_not_contain_key(self, *keys: _K | Matcher[_K]) -> AssertionOutcome: ...
582
+ def contains_value(self, *values: _V | Matcher[_V]) -> AssertionOutcome: ...
583
+ def does_not_contain_value(self, *values: _V | Matcher[_V]) -> AssertionOutcome: ...
584
+ def contains_entry(self, *args: object, **kwargs: object) -> AssertionOutcome: ...
585
+ def does_not_contain_entry(self, *args: object, **kwargs: object) -> AssertionOutcome: ...
586
+ def does_not_contain(self, *items: object) -> AssertionOutcome: ...
587
+ def contains_only(self, *keys: object) -> AssertionOutcome: ...
588
+ def is_sorted(
589
+ self, key: Callable[[_K], object] = ..., reverse: bool = ..., *, allow_empty: bool = ...
590
+ ) -> AssertionOutcome: ...
591
+ def matches_structure(self, spec: dict[Any, Any]) -> AssertionOutcome: ...
592
+ @property
593
+ def not_(self) -> Self: ...
594
+
595
+ class _CheckCollectionShapedAssertion(
596
+ _CheckSizedAssertion, _CheckMembershipAssertion, _CheckWalkAssertion, Protocol
597
+ ):
598
+ """The verdict twin of `_CollectionShapedAssertion`."""
599
+
600
+ def contains(self, *items: object) -> AssertionOutcome: ...
601
+ def does_not_contain(self, *items: object) -> AssertionOutcome: ...
602
+ def contains_only(self, *items: object) -> AssertionOutcome: ...
603
+ @property
604
+ def not_(self) -> Self: ...
605
+
606
+ class _CheckArrayLikeAssertion(_CheckCollectionShapedAssertion, _CheckCoreAssertion, Protocol):
607
+ """The verdict twin of `_ArrayLikeAssertion`."""
608
+
609
+ def is_array_equal(self, expected: object, **options: Any) -> AssertionOutcome: ...
610
+ def is_array_close_to(
611
+ self, expected: object, *, rtol: float = ..., atol: float = ..., equal_nan: bool = ..., **options: Any
612
+ ) -> AssertionOutcome: ...
613
+ @property
614
+ def not_(self) -> Self: ...
615
+
616
+ class _CheckFrameAssertion(_CheckArrayLikeAssertion, Protocol[_FrameT_co]):
617
+ """The verdict twin of `_FrameAssertion`."""
618
+
619
+ def is_frame_equal(self, expected: object, **options: Any) -> AssertionOutcome: ...
620
+ @property
621
+ def not_(self) -> Self: ...
622
+
623
+ class _CheckArrayAssertion(_CheckArrayLikeAssertion, Protocol[_ArrayT_co]):
624
+ """The verdict twin of `_ArrayAssertion`."""
625
+
626
+ @property
627
+ def not_(self) -> Self: ...
628
+
629
+ class _CheckDateAssertion(_CheckCoreAssertion, Protocol):
630
+ """The verdict twin of `_DateAssertion`."""
631
+
632
+ def is_greater_than(self, other: datetime.date) -> AssertionOutcome: ...
633
+ def is_greater_than_or_equal_to(self, other: datetime.date) -> AssertionOutcome: ...
634
+ def is_less_than(self, other: datetime.date) -> AssertionOutcome: ...
635
+ def is_less_than_or_equal_to(self, other: datetime.date) -> AssertionOutcome: ...
636
+ def is_between(self, low: datetime.date, high: datetime.date) -> AssertionOutcome: ...
637
+ def is_not_between(self, low: datetime.date, high: datetime.date) -> AssertionOutcome: ...
638
+ @property
639
+ def not_(self) -> Self: ...
640
+
641
+ class _CheckDateTimeAssertion(_CheckCoreAssertion, Protocol):
642
+ """The verdict twin of `_DateTimeAssertion`."""
643
+
644
+ def is_greater_than(self, other: datetime.datetime) -> AssertionOutcome: ...
645
+ def is_greater_than_or_equal_to(self, other: datetime.datetime) -> AssertionOutcome: ...
646
+ def is_less_than(self, other: datetime.datetime) -> AssertionOutcome: ...
647
+ def is_less_than_or_equal_to(self, other: datetime.datetime) -> AssertionOutcome: ...
648
+ def is_between(self, low: datetime.datetime, high: datetime.datetime) -> AssertionOutcome: ...
649
+ def is_not_between(self, low: datetime.datetime, high: datetime.datetime) -> AssertionOutcome: ...
650
+ def is_before(self, other: datetime.datetime) -> AssertionOutcome: ...
651
+ def is_after(self, other: datetime.datetime) -> AssertionOutcome: ...
652
+ def is_before_or_equal_to(self, other: datetime.datetime) -> AssertionOutcome: ...
653
+ def is_after_or_equal_to(self, other: datetime.datetime) -> AssertionOutcome: ...
654
+ def is_equal_to_ignoring_milliseconds(self, other: datetime.datetime) -> AssertionOutcome: ...
655
+ def is_equal_to_ignoring_seconds(self, other: datetime.datetime) -> AssertionOutcome: ...
656
+ def is_equal_to_ignoring_time(self, other: datetime.datetime) -> AssertionOutcome: ...
657
+ def is_close_to(
658
+ self, other: datetime.datetime, tolerance: datetime.timedelta | None = ..., *, rel: None = ...
659
+ ) -> AssertionOutcome: ...
660
+ def is_not_close_to(
661
+ self, other: datetime.datetime, tolerance: datetime.timedelta | None = ..., *, rel: None = ...
662
+ ) -> AssertionOutcome: ...
663
+ @property
664
+ def not_(self) -> Self: ...
665
+
666
+ class _CheckPathAssertion(_CheckFilesystemAssertion, _CheckCoreAssertion, Protocol):
667
+ """The verdict twin of `_PathAssertion`."""
668
+
669
+ @property
670
+ def not_(self) -> Self: ...
671
+
672
+ class _CheckBytesAssertion(_CheckMembershipAssertion, _CheckSizedAssertion, _CheckCoreAssertion, Protocol[_B_co]):
673
+ """The verdict twin of `_BytesAssertion`."""
674
+
675
+ def contains(self, *items: object) -> AssertionOutcome: ...
676
+ def does_not_contain(self, *items: object) -> AssertionOutcome: ...
677
+ def is_sorted(
678
+ self, key: Callable[[int], object] = ..., reverse: bool = ..., *, allow_empty: bool = ...
679
+ ) -> AssertionOutcome: ...
680
+ def starts_with(self, prefix: bytes | bytearray) -> AssertionOutcome: ...
681
+ def ends_with(self, suffix: bytes | bytearray) -> AssertionOutcome: ...
682
+ def is_valid_utf8(self) -> AssertionOutcome: ...
683
+ def is_valid_encoding(self, encoding: str) -> AssertionOutcome: ...
684
+ def starts_with_bytes(self, prefix: bytes | bytearray) -> AssertionOutcome: ...
685
+ def contains_bytes(self, sub: bytes | bytearray) -> AssertionOutcome: ...
686
+ def has_byte_at(self, index: SupportsIndex, expected: SupportsIndex) -> AssertionOutcome: ...
687
+ def is_hex_equal_to(self, expected_hex: str) -> AssertionOutcome: ...
688
+ def is_greater_than(self, other: bytes | bytearray) -> AssertionOutcome: ...
689
+ def is_greater_than_or_equal_to(self, other: bytes | bytearray) -> AssertionOutcome: ...
690
+ def is_less_than(self, other: bytes | bytearray) -> AssertionOutcome: ...
691
+ def is_less_than_or_equal_to(self, other: bytes | bytearray) -> AssertionOutcome: ...
692
+ @property
693
+ def not_(self) -> Self: ...
694
+
695
+ class _CheckInvokedAssertion(_CheckTextAssertion, Protocol[_Exc_co]):
696
+ """The verdict twin of `_InvokedAssertion`."""
697
+
698
+ @overload
699
+ def caused_by(self, ex: type[_Landed]) -> AssertionOutcome: ...
700
+ @overload
701
+ def caused_by(self, ex: ClassInfo) -> AssertionOutcome: ...
702
+ @overload
703
+ def error_of(self, ex: type[_Landed]) -> AssertionOutcome: ...
704
+ @overload
705
+ def error_of(self, ex: type) -> AssertionOutcome: ...
706
+ def does_not_contain_error(self, *ex_types: type | ExceptionInfo) -> AssertionOutcome: ...
707
+ @overload
708
+ def has_root_cause(self, ex: type[_Landed]) -> AssertionOutcome: ...
709
+ @overload
710
+ def has_root_cause(self, ex: ClassInfo) -> AssertionOutcome: ...
711
+ def contains_error(self, *ex_types: type | ExceptionInfo) -> AssertionOutcome: ...
712
+ def matches_error_tree(self, *expected: type | list[Any]) -> AssertionOutcome: ...
713
+ @property
714
+ def not_(self) -> Self: ...
715
+
716
+ class _CheckWarnedAssertion(_CheckTextAssertion, Protocol[_P_co]):
717
+ """The verdict twin of `_WarnedAssertion`."""
718
+
719
+ @property
720
+ def not_(self) -> Self: ...
721
+
722
+ class _CheckCallableAssertion(_CheckCoreAssertion, Protocol[_P_co]):
723
+ """The verdict twin of `_CallableAssertion`."""
724
+
725
+ @property
726
+ def not_(self) -> Self: ...
727
+
728
+ class _CheckCompletedAssertion(_CheckCallableAssertion[_P_co], Protocol[_P_co]):
729
+ """The verdict twin of `_CompletedAssertion`."""
730
+
731
+ @property
732
+ def not_(self) -> Self: ...
733
+
734
+ class _CheckExpectedRaiseAssertion(_CheckCallableAssertion[_P_co], Protocol[_P_co, _Exc_co]):
735
+ """The verdict twin of `_ExpectedRaiseAssertion`."""
736
+
737
+ def when_called_with(self, *some_args: object, **some_kwargs: object) -> AssertionOutcome: ...
738
+ @property
739
+ def not_(self) -> Self: ...
740
+
741
+ class _CheckExpectedWarningAssertion(_CheckCallableAssertion[_P_co], Protocol[_P_co]):
742
+ """The verdict twin of `_ExpectedWarningAssertion`."""
743
+
744
+ def when_called_with(self, *some_args: object, **some_kwargs: object) -> AssertionOutcome: ...
745
+ @property
746
+ def not_(self) -> Self: ...
747
+
748
+ class _CheckExpectedCompletionAssertion(_CheckCallableAssertion[_P_co], Protocol[_P_co]):
749
+ """The verdict twin of `_ExpectedCompletionAssertion`."""
750
+
751
+ def when_called_with(self, *some_args: object, **some_kwargs: object) -> AssertionOutcome: ...
752
+ @property
753
+ def not_(self) -> Self: ...