pytest-check 2.7.4__tar.gz → 2.7.6__tar.gz
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.
- {pytest_check-2.7.4 → pytest_check-2.7.6}/PKG-INFO +1 -1
- {pytest_check-2.7.4 → pytest_check-2.7.6}/changelog.md +15 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_mypy.py +46 -4
- pytest_check-2.7.6/examples/test_example_mypy_fail.py +27 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/pyproject.toml +1 -1
- pytest_check-2.7.6/src/pytest_check/__init__.pyi +218 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/src/pytest_check/check_functions.py +95 -7
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_xfail.py +6 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tox.ini +9 -5
- pytest_check-2.7.4/src/pytest_check/__init__.pyi +0 -107
- {pytest_check-2.7.4 → pytest_check-2.7.6}/.coveragerc +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/.github/.deployment.md +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/.github/FUNDING.yml +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/.github/workflows/main.yml +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/.github/workflows/publish-to-pypi.yml +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/.gitignore +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/LICENSE.txt +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/README.md +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/logging_to_a_file/conftest.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/logging_to_a_file/test_file_logging.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_alt_names.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_any_failures.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_check_and_assert.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_check_check.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_check_func_decorator.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_check_not_in_test.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_context_functions.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_context_manager_fail.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_context_manager_pass.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_context_manager_type.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_fail_func.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_fail_in_fixture.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_fail_in_teardown_with_skip.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_fail_in_thread.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_functions_fail.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_functions_pass.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_helpers.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_httpx.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_locals.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_logging.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_maxfail.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_message.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_mix_checks_and_assertions.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_multiple_failures.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_pass_in_thread.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_raises.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_simple.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_speedup_funcs.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_stop_on_fail.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_summary.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_tb_style.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_traceback.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_tracebackhide.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_xfail.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/src/pytest_check/__init__.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/src/pytest_check/check_log.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/src/pytest_check/check_raises.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/src/pytest_check/context_manager.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/src/pytest_check/plugin.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/src/pytest_check/pseudo_traceback.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/src/pytest_check/py.typed +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/__init__.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/conftest.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_alt_names.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_any_failures.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_check_and_assert.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_check_check.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_check_context_manager.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_check_fixture.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_check_func_decorator.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_fail_func.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_fail_in_fixture.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_fail_in_teardown_with_skip.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_functions.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_helpers.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_locals.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_logging.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_maxfail.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_message.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_not_in_test.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_raises.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_red.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_speedup_flags.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_speedup_functions.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_stop_on_fail.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_summary.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_tb_style.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_thread.py +0 -0
- {pytest_check-2.7.4 → pytest_check-2.7.6}/tests/test_tracebackhide.py +0 -0
|
@@ -28,6 +28,21 @@ All notable changes to this project will be documented in this file.
|
|
|
28
28
|
|
|
29
29
|
-->
|
|
30
30
|
|
|
31
|
+
## [2.7.6] - 2026-Mar-04
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- (typing) Set comparison function types such that None is not allowed
|
|
36
|
+
|
|
37
|
+
## [2.7.5] - 2026-Mar-04
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
|
|
41
|
+
- Passing `None` to comparison functions like `greater()`, `less()`, etc. used to raise an exception, which caused a test failure and stopped the test.
|
|
42
|
+
- That's unexpected with a check function.
|
|
43
|
+
- So now the check fails with a meaningful error message and continues with the rest of the test.
|
|
44
|
+
- (typing) Allow numpy floats with comparison functions to pass mypy.
|
|
45
|
+
|
|
31
46
|
## [2.7.4] - 2026-Mar-03
|
|
32
47
|
|
|
33
48
|
### Fixed
|
|
@@ -7,16 +7,25 @@ Normally you would import the check functions like this:
|
|
|
7
7
|
We're testing that an old form of import also works:
|
|
8
8
|
import pytest_check as check
|
|
9
9
|
|
|
10
|
-
However, please be aware that this method of importing is deprecated and
|
|
10
|
+
However, please be aware that this method of importing is deprecated and
|
|
11
11
|
support may be removed in future versions.
|
|
12
12
|
|
|
13
13
|
The original content of this file is from test_example_functions_pass.py.
|
|
14
|
-
But I've also added more tests to check for anything I want to get
|
|
14
|
+
But I've also added more tests to check for anything I want to get
|
|
15
15
|
tested with `mypy --strict`.
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
|
-
import pytest_check as check
|
|
19
18
|
import math
|
|
19
|
+
import importlib
|
|
20
|
+
from typing import Any
|
|
21
|
+
import pytest
|
|
22
|
+
import pytest_check as check
|
|
23
|
+
|
|
24
|
+
try:
|
|
25
|
+
np: Any = importlib.import_module("numpy")
|
|
26
|
+
except ModuleNotFoundError:
|
|
27
|
+
np = None
|
|
28
|
+
|
|
20
29
|
|
|
21
30
|
def test_equal() -> None:
|
|
22
31
|
check.equal(1, 1)
|
|
@@ -100,11 +109,13 @@ def test_greater_equal() -> None:
|
|
|
100
109
|
check.greater_equal(2, 1)
|
|
101
110
|
check.greater_equal(1, 1)
|
|
102
111
|
|
|
103
|
-
|
|
112
|
+
|
|
113
|
+
def test_int_float() -> None:
|
|
104
114
|
check.greater(2, 1.9)
|
|
105
115
|
check.greater_equal(2, 1.9)
|
|
106
116
|
check.less(1.9, 2)
|
|
107
117
|
check.less_equal(1.9, 2)
|
|
118
|
+
check.between(10, 4.5, 20)
|
|
108
119
|
|
|
109
120
|
|
|
110
121
|
def test_less() -> None:
|
|
@@ -140,3 +151,34 @@ def test_between_equal() -> None:
|
|
|
140
151
|
check.between_equal(0, 0, 20)
|
|
141
152
|
check.between_equal(10, 0, 20)
|
|
142
153
|
check.between_equal(20, 0, 20)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
@pytest.mark.skipif(np is None, reason="numpy is not installed")
|
|
157
|
+
def test_greater_equal_max_int() -> None:
|
|
158
|
+
if np is not None:
|
|
159
|
+
check.greater_equal(np.iinfo(np.int32).max, 0)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
@pytest.mark.skipif(np is None, reason="numpy is not installed")
|
|
163
|
+
def test_greater_equal_max_float() -> None:
|
|
164
|
+
if np is not None:
|
|
165
|
+
check.greater_equal(np.finfo(np.float32).max, 0)
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
@pytest.mark.skipif(np is None, reason="numpy is not installed")
|
|
169
|
+
def test_greater_max_int() -> None:
|
|
170
|
+
if np is not None:
|
|
171
|
+
check.greater(np.iinfo(np.int32).max, 0)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
@pytest.mark.skipif(np is None, reason="numpy is not installed")
|
|
175
|
+
def test_less_min_float() -> None:
|
|
176
|
+
if np is not None:
|
|
177
|
+
check.less(np.finfo(np.float32).min, 0)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
@pytest.mark.skipif(np is None, reason="numpy is not installed")
|
|
181
|
+
def test_less_equal_max_float() -> None:
|
|
182
|
+
if np is not None:
|
|
183
|
+
max_f32 = np.finfo(np.float32).max
|
|
184
|
+
check.less_equal(max_f32, max_f32)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from pytest_check import check
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@pytest.mark.xfail(reason="None cannot be compared")
|
|
6
|
+
def test_none_less() -> None:
|
|
7
|
+
check.less(None, 1)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.mark.xfail(reason="None cannot be compared")
|
|
11
|
+
def test_none_less_equal() -> None:
|
|
12
|
+
check.less_equal(None, 1)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@pytest.mark.xfail(reason="None cannot be compared")
|
|
16
|
+
def test_none_greater() -> None:
|
|
17
|
+
check.greater(1, None)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@pytest.mark.xfail(reason="None cannot be compared")
|
|
21
|
+
def test_none_greater_equal() -> None:
|
|
22
|
+
check.greater_equal(1, None)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@pytest.mark.xfail(reason="None cannot be compared")
|
|
26
|
+
def test_none_between() -> None:
|
|
27
|
+
check.between(1, None, 2)
|
|
@@ -4,7 +4,7 @@ authors = [{name = "Brian Okken"}]
|
|
|
4
4
|
readme = "README.md"
|
|
5
5
|
license = {file = "LICENSE.txt"}
|
|
6
6
|
description="A pytest plugin that allows multiple failures per test."
|
|
7
|
-
version = "2.7.
|
|
7
|
+
version = "2.7.6"
|
|
8
8
|
requires-python = ">=3.9"
|
|
9
9
|
classifiers = [
|
|
10
10
|
'Development Status :: 5 - Production/Stable',
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import (
|
|
4
|
+
Any,
|
|
5
|
+
Callable,
|
|
6
|
+
Protocol,
|
|
7
|
+
SupportsFloat,
|
|
8
|
+
SupportsIndex,
|
|
9
|
+
TypeVar,
|
|
10
|
+
overload,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
from .context_manager import CheckContextManager as _BaseCheck
|
|
14
|
+
from .check_functions import (
|
|
15
|
+
assert_equal,
|
|
16
|
+
equal,
|
|
17
|
+
not_equal,
|
|
18
|
+
is_,
|
|
19
|
+
is_not,
|
|
20
|
+
is_true,
|
|
21
|
+
is_false,
|
|
22
|
+
is_none,
|
|
23
|
+
is_not_none,
|
|
24
|
+
is_nan,
|
|
25
|
+
is_not_nan,
|
|
26
|
+
is_in,
|
|
27
|
+
is_not_in,
|
|
28
|
+
is_instance,
|
|
29
|
+
is_not_instance,
|
|
30
|
+
almost_equal,
|
|
31
|
+
not_almost_equal,
|
|
32
|
+
greater,
|
|
33
|
+
greater_equal,
|
|
34
|
+
less,
|
|
35
|
+
less_equal,
|
|
36
|
+
between,
|
|
37
|
+
between_equal,
|
|
38
|
+
check_func,
|
|
39
|
+
fail,
|
|
40
|
+
)
|
|
41
|
+
from .check_raises import raises
|
|
42
|
+
from .check_log import any_failures
|
|
43
|
+
|
|
44
|
+
_CmpT = TypeVar("_CmpT", contravariant=True)
|
|
45
|
+
|
|
46
|
+
class _ComparableGreaterThan(Protocol[_CmpT]):
|
|
47
|
+
def __gt__(self, other: _CmpT, /) -> bool: ...
|
|
48
|
+
|
|
49
|
+
class _ComparableGreaterThanOrEqual(Protocol[_CmpT]):
|
|
50
|
+
def __ge__(self, other: _CmpT, /) -> bool: ...
|
|
51
|
+
|
|
52
|
+
class _ComparableLessThan(Protocol[_CmpT]):
|
|
53
|
+
def __lt__(self, other: _CmpT, /) -> bool: ...
|
|
54
|
+
|
|
55
|
+
class _ComparableLessThanOrEqual(Protocol[_CmpT]):
|
|
56
|
+
def __le__(self, other: _CmpT, /) -> bool: ...
|
|
57
|
+
|
|
58
|
+
class CheckType(_BaseCheck):
|
|
59
|
+
# Helper functions exposed as attributes on the check object
|
|
60
|
+
assert_equal: Callable[..., None]
|
|
61
|
+
equal: Callable[..., bool]
|
|
62
|
+
not_equal: Callable[..., bool]
|
|
63
|
+
is_: Callable[..., bool]
|
|
64
|
+
is_not: Callable[..., bool]
|
|
65
|
+
is_true: Callable[..., bool]
|
|
66
|
+
is_false: Callable[..., bool]
|
|
67
|
+
is_none: Callable[..., bool]
|
|
68
|
+
is_not_none: Callable[..., bool]
|
|
69
|
+
is_nan: Callable[..., bool]
|
|
70
|
+
is_not_nan: Callable[..., bool]
|
|
71
|
+
is_in: Callable[..., bool]
|
|
72
|
+
is_not_in: Callable[..., bool]
|
|
73
|
+
is_instance: Callable[..., bool]
|
|
74
|
+
is_not_instance: Callable[..., bool]
|
|
75
|
+
almost_equal: Callable[..., bool]
|
|
76
|
+
not_almost_equal: Callable[..., bool]
|
|
77
|
+
@overload
|
|
78
|
+
def greater(self, a: float, b: float, msg: str = "") -> bool: ...
|
|
79
|
+
@overload
|
|
80
|
+
def greater(
|
|
81
|
+
self,
|
|
82
|
+
a: SupportsFloat | SupportsIndex,
|
|
83
|
+
b: SupportsFloat | SupportsIndex,
|
|
84
|
+
msg: str = "",
|
|
85
|
+
) -> bool: ...
|
|
86
|
+
@overload
|
|
87
|
+
def greater(
|
|
88
|
+
self, a: _ComparableGreaterThan[_CmpT], b: _CmpT, msg: str = ""
|
|
89
|
+
) -> bool: ...
|
|
90
|
+
@overload
|
|
91
|
+
def greater_equal(self, a: float, b: float, msg: str = "") -> bool: ...
|
|
92
|
+
@overload
|
|
93
|
+
def greater_equal(
|
|
94
|
+
self,
|
|
95
|
+
a: SupportsFloat | SupportsIndex,
|
|
96
|
+
b: SupportsFloat | SupportsIndex,
|
|
97
|
+
msg: str = "",
|
|
98
|
+
) -> bool: ...
|
|
99
|
+
@overload
|
|
100
|
+
def greater_equal(
|
|
101
|
+
self, a: _ComparableGreaterThanOrEqual[_CmpT], b: _CmpT, msg: str = ""
|
|
102
|
+
) -> bool: ...
|
|
103
|
+
@overload
|
|
104
|
+
def less(self, a: float, b: float, msg: str = "") -> bool: ...
|
|
105
|
+
@overload
|
|
106
|
+
def less(
|
|
107
|
+
self,
|
|
108
|
+
a: SupportsFloat | SupportsIndex,
|
|
109
|
+
b: SupportsFloat | SupportsIndex,
|
|
110
|
+
msg: str = "",
|
|
111
|
+
) -> bool: ...
|
|
112
|
+
@overload
|
|
113
|
+
def less(self, a: _ComparableLessThan[_CmpT], b: _CmpT, msg: str = "") -> bool: ...
|
|
114
|
+
@overload
|
|
115
|
+
def less_equal(self, a: float, b: float, msg: str = "") -> bool: ...
|
|
116
|
+
@overload
|
|
117
|
+
def less_equal(
|
|
118
|
+
self,
|
|
119
|
+
a: SupportsFloat | SupportsIndex,
|
|
120
|
+
b: SupportsFloat | SupportsIndex,
|
|
121
|
+
msg: str = "",
|
|
122
|
+
) -> bool: ...
|
|
123
|
+
@overload
|
|
124
|
+
def less_equal(
|
|
125
|
+
self, a: _ComparableLessThanOrEqual[_CmpT], b: _CmpT, msg: str = ""
|
|
126
|
+
) -> bool: ...
|
|
127
|
+
@overload
|
|
128
|
+
def between(
|
|
129
|
+
self,
|
|
130
|
+
b: float,
|
|
131
|
+
a: float,
|
|
132
|
+
c: float,
|
|
133
|
+
msg: str = "",
|
|
134
|
+
ge: bool = False,
|
|
135
|
+
le: bool = False,
|
|
136
|
+
) -> bool: ...
|
|
137
|
+
@overload
|
|
138
|
+
def between(
|
|
139
|
+
self,
|
|
140
|
+
b: SupportsFloat | SupportsIndex,
|
|
141
|
+
a: SupportsFloat | SupportsIndex,
|
|
142
|
+
c: SupportsFloat | SupportsIndex,
|
|
143
|
+
msg: str = "",
|
|
144
|
+
ge: bool = False,
|
|
145
|
+
le: bool = False,
|
|
146
|
+
) -> bool: ...
|
|
147
|
+
@overload
|
|
148
|
+
def between(
|
|
149
|
+
self,
|
|
150
|
+
b: _ComparableLessThanOrEqual[_CmpT],
|
|
151
|
+
a: _CmpT,
|
|
152
|
+
c: _CmpT,
|
|
153
|
+
msg: str = "",
|
|
154
|
+
ge: bool = False,
|
|
155
|
+
le: bool = False,
|
|
156
|
+
) -> bool: ...
|
|
157
|
+
@overload
|
|
158
|
+
def between_equal(self, b: float, a: float, c: float, msg: str = "") -> bool: ...
|
|
159
|
+
@overload
|
|
160
|
+
def between_equal(
|
|
161
|
+
self,
|
|
162
|
+
b: SupportsFloat | SupportsIndex,
|
|
163
|
+
a: SupportsFloat | SupportsIndex,
|
|
164
|
+
c: SupportsFloat | SupportsIndex,
|
|
165
|
+
msg: str = "",
|
|
166
|
+
) -> bool: ...
|
|
167
|
+
@overload
|
|
168
|
+
def between_equal(
|
|
169
|
+
self,
|
|
170
|
+
b: _ComparableLessThanOrEqual[_CmpT],
|
|
171
|
+
a: _CmpT,
|
|
172
|
+
c: _CmpT,
|
|
173
|
+
msg: str = "",
|
|
174
|
+
) -> bool: ...
|
|
175
|
+
check_func: Callable[..., Callable[..., bool]]
|
|
176
|
+
fail: Callable[..., None]
|
|
177
|
+
|
|
178
|
+
# Extra helpers attached in __init__.py
|
|
179
|
+
raises: Callable[..., Any]
|
|
180
|
+
any_failures: Callable[..., bool]
|
|
181
|
+
|
|
182
|
+
# Some users do check.check, so keep it typed
|
|
183
|
+
check: "CheckType"
|
|
184
|
+
|
|
185
|
+
check: CheckType
|
|
186
|
+
|
|
187
|
+
__all__ = [
|
|
188
|
+
# main interface objects
|
|
189
|
+
"check",
|
|
190
|
+
"raises",
|
|
191
|
+
"any_failures",
|
|
192
|
+
# helper functions available as module attributes
|
|
193
|
+
"assert_equal",
|
|
194
|
+
"equal",
|
|
195
|
+
"not_equal",
|
|
196
|
+
"is_",
|
|
197
|
+
"is_not",
|
|
198
|
+
"is_true",
|
|
199
|
+
"is_false",
|
|
200
|
+
"is_none",
|
|
201
|
+
"is_not_none",
|
|
202
|
+
"is_nan",
|
|
203
|
+
"is_not_nan",
|
|
204
|
+
"is_in",
|
|
205
|
+
"is_not_in",
|
|
206
|
+
"is_instance",
|
|
207
|
+
"is_not_instance",
|
|
208
|
+
"almost_equal",
|
|
209
|
+
"not_almost_equal",
|
|
210
|
+
"greater",
|
|
211
|
+
"greater_equal",
|
|
212
|
+
"less",
|
|
213
|
+
"less_equal",
|
|
214
|
+
"between",
|
|
215
|
+
"between_equal",
|
|
216
|
+
"check_func",
|
|
217
|
+
"fail",
|
|
218
|
+
]
|
|
@@ -54,7 +54,6 @@ __all__ = [
|
|
|
54
54
|
_P = ParamSpec("_P")
|
|
55
55
|
_T = TypeVar("_T")
|
|
56
56
|
|
|
57
|
-
|
|
58
57
|
_CmpT = TypeVar("_CmpT", contravariant=True)
|
|
59
58
|
|
|
60
59
|
|
|
@@ -255,13 +254,22 @@ def not_almost_equal(
|
|
|
255
254
|
def greater(a: float, b: float, msg: str = "") -> bool: ...
|
|
256
255
|
|
|
257
256
|
|
|
257
|
+
@overload
|
|
258
|
+
def greater(
|
|
259
|
+
a: SupportsFloat | SupportsIndex, b: SupportsFloat | SupportsIndex, msg: str = ""
|
|
260
|
+
) -> bool: ...
|
|
261
|
+
|
|
262
|
+
|
|
258
263
|
@overload
|
|
259
264
|
def greater(a: _ComparableGreaterThan[_CmpT], b: _CmpT, msg: str = "") -> bool: ...
|
|
260
265
|
|
|
261
266
|
|
|
262
267
|
def greater(a: Any, b: Any, msg: str = "") -> bool:
|
|
263
268
|
__tracebackhide__ = True
|
|
264
|
-
if a
|
|
269
|
+
if a is None or b is None:
|
|
270
|
+
log_failure(f"check {a} > {b}: None cannot be compared", msg)
|
|
271
|
+
return False
|
|
272
|
+
elif a > b:
|
|
265
273
|
return True
|
|
266
274
|
else:
|
|
267
275
|
log_failure(f"check {a} > {b}", msg)
|
|
@@ -272,6 +280,12 @@ def greater(a: Any, b: Any, msg: str = "") -> bool:
|
|
|
272
280
|
def greater_equal(a: float, b: float, msg: str = "") -> bool: ...
|
|
273
281
|
|
|
274
282
|
|
|
283
|
+
@overload
|
|
284
|
+
def greater_equal(
|
|
285
|
+
a: SupportsFloat | SupportsIndex, b: SupportsFloat | SupportsIndex, msg: str = ""
|
|
286
|
+
) -> bool: ...
|
|
287
|
+
|
|
288
|
+
|
|
275
289
|
@overload
|
|
276
290
|
def greater_equal(
|
|
277
291
|
a: _ComparableGreaterThanOrEqual[_CmpT], b: _CmpT, msg: str = ""
|
|
@@ -280,7 +294,10 @@ def greater_equal(
|
|
|
280
294
|
|
|
281
295
|
def greater_equal(a: Any, b: Any, msg: str = "") -> bool:
|
|
282
296
|
__tracebackhide__ = True
|
|
283
|
-
if a
|
|
297
|
+
if a is None or b is None:
|
|
298
|
+
log_failure(f"check {a} >= {b}: None cannot be compared", msg)
|
|
299
|
+
return False
|
|
300
|
+
elif a >= b:
|
|
284
301
|
return True
|
|
285
302
|
else:
|
|
286
303
|
log_failure(f"check {a} >= {b}", msg)
|
|
@@ -291,13 +308,22 @@ def greater_equal(a: Any, b: Any, msg: str = "") -> bool:
|
|
|
291
308
|
def less(a: float, b: float, msg: str = "") -> bool: ...
|
|
292
309
|
|
|
293
310
|
|
|
311
|
+
@overload
|
|
312
|
+
def less(
|
|
313
|
+
a: SupportsFloat | SupportsIndex, b: SupportsFloat | SupportsIndex, msg: str = ""
|
|
314
|
+
) -> bool: ...
|
|
315
|
+
|
|
316
|
+
|
|
294
317
|
@overload
|
|
295
318
|
def less(a: _ComparableLessThan[_CmpT], b: _CmpT, msg: str = "") -> bool: ...
|
|
296
319
|
|
|
297
320
|
|
|
298
321
|
def less(a: Any, b: Any, msg: str = "") -> bool:
|
|
299
322
|
__tracebackhide__ = True
|
|
300
|
-
if a
|
|
323
|
+
if a is None or b is None:
|
|
324
|
+
log_failure(f"check {a} < {b}: None cannot be compared", msg)
|
|
325
|
+
return False
|
|
326
|
+
elif a < b:
|
|
301
327
|
return True
|
|
302
328
|
else:
|
|
303
329
|
log_failure(f"check {a} < {b}", msg)
|
|
@@ -308,6 +334,12 @@ def less(a: Any, b: Any, msg: str = "") -> bool:
|
|
|
308
334
|
def less_equal(a: float, b: float, msg: str = "") -> bool: ...
|
|
309
335
|
|
|
310
336
|
|
|
337
|
+
@overload
|
|
338
|
+
def less_equal(
|
|
339
|
+
a: SupportsFloat | SupportsIndex, b: SupportsFloat | SupportsIndex, msg: str = ""
|
|
340
|
+
) -> bool: ...
|
|
341
|
+
|
|
342
|
+
|
|
311
343
|
@overload
|
|
312
344
|
def less_equal(
|
|
313
345
|
a: _ComparableLessThanOrEqual[_CmpT], b: _CmpT, msg: str = ""
|
|
@@ -316,18 +348,52 @@ def less_equal(
|
|
|
316
348
|
|
|
317
349
|
def less_equal(a: Any, b: Any, msg: str = "") -> bool:
|
|
318
350
|
__tracebackhide__ = True
|
|
319
|
-
if a
|
|
351
|
+
if a is None or b is None:
|
|
352
|
+
log_failure(f"check {a} <= {b}: None cannot be compared", msg)
|
|
353
|
+
return False
|
|
354
|
+
elif a <= b:
|
|
320
355
|
return True
|
|
321
356
|
else:
|
|
322
357
|
log_failure(f"check {a} <= {b}", msg)
|
|
323
358
|
return False
|
|
324
359
|
|
|
325
360
|
|
|
361
|
+
@overload
|
|
362
|
+
def between(
|
|
363
|
+
b: float, a: float, c: float, msg: str = "", ge: bool = False, le: bool = False
|
|
364
|
+
) -> bool: ...
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
@overload
|
|
368
|
+
def between(
|
|
369
|
+
b: SupportsFloat | SupportsIndex,
|
|
370
|
+
a: SupportsFloat | SupportsIndex,
|
|
371
|
+
c: SupportsFloat | SupportsIndex,
|
|
372
|
+
msg: str = "",
|
|
373
|
+
ge: bool = False,
|
|
374
|
+
le: bool = False,
|
|
375
|
+
) -> bool: ...
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
@overload
|
|
379
|
+
def between(
|
|
380
|
+
b: _ComparableLessThanOrEqual[_CmpT],
|
|
381
|
+
a: _CmpT,
|
|
382
|
+
c: _CmpT,
|
|
383
|
+
msg: str = "",
|
|
384
|
+
ge: bool = False,
|
|
385
|
+
le: bool = False,
|
|
386
|
+
) -> bool: ...
|
|
387
|
+
|
|
388
|
+
|
|
326
389
|
def between(
|
|
327
390
|
b: Any, a: Any, c: Any, msg: str = "", ge: bool = False, le: bool = False
|
|
328
391
|
) -> bool:
|
|
329
392
|
__tracebackhide__ = True
|
|
330
|
-
if
|
|
393
|
+
if a is None or b is None or c is None:
|
|
394
|
+
log_failure(f"check {a} <= {b} <= {c}: None cannot be compared", msg)
|
|
395
|
+
return False
|
|
396
|
+
elif ge and le:
|
|
331
397
|
if a <= b <= c:
|
|
332
398
|
return True
|
|
333
399
|
else:
|
|
@@ -353,11 +419,33 @@ def between(
|
|
|
353
419
|
return False
|
|
354
420
|
|
|
355
421
|
|
|
422
|
+
@overload
|
|
423
|
+
def between_equal(b: float, a: float, c: float, msg: str = "") -> bool: ...
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
@overload
|
|
427
|
+
def between_equal(
|
|
428
|
+
b: SupportsFloat | SupportsIndex,
|
|
429
|
+
a: SupportsFloat | SupportsIndex,
|
|
430
|
+
c: SupportsFloat | SupportsIndex,
|
|
431
|
+
msg: str = "",
|
|
432
|
+
) -> bool: ...
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
@overload
|
|
356
436
|
def between_equal(
|
|
357
437
|
b: _ComparableLessThanOrEqual[_CmpT],
|
|
358
|
-
a:
|
|
438
|
+
a: _CmpT,
|
|
359
439
|
c: _CmpT,
|
|
360
440
|
msg: str = "",
|
|
441
|
+
) -> bool: ...
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
def between_equal(
|
|
445
|
+
b: Any,
|
|
446
|
+
a: Any,
|
|
447
|
+
c: Any,
|
|
448
|
+
msg: str = "",
|
|
361
449
|
) -> bool:
|
|
362
450
|
__tracebackhide__ = True
|
|
363
451
|
return between(b, a, c, msg, ge=True, le=True)
|
|
@@ -102,3 +102,9 @@ def test_xfail_raises_multiple_marks_one_matches(pytester):
|
|
|
102
102
|
)
|
|
103
103
|
result.assert_outcomes(xfailed=1)
|
|
104
104
|
result.stdout.fnmatch_lines(["* 1 xfailed *"])
|
|
105
|
+
|
|
106
|
+
def test_xfail_mypy(pytester):
|
|
107
|
+
pytester.copy_example("examples/test_example_mypy_fail.py")
|
|
108
|
+
result = pytester.runpytest("test_example_mypy_fail.py")
|
|
109
|
+
result.assert_outcomes(xfailed=5)
|
|
110
|
+
result.stdout.fnmatch_lines(["* 5 xfailed *"])
|
|
@@ -44,18 +44,22 @@ description = Run ruff over src, test, examples
|
|
|
44
44
|
deps =
|
|
45
45
|
mypy
|
|
46
46
|
httpx
|
|
47
|
+
numpy
|
|
47
48
|
# pluggy added type checking support in version 1.3.0
|
|
48
49
|
pluggy>=1.3,<2
|
|
49
50
|
base_python = python3.14
|
|
50
51
|
commands =
|
|
51
52
|
# want strict for src so users can use strict if they want
|
|
52
|
-
mypy --strict
|
|
53
|
+
mypy --strict src
|
|
53
54
|
|
|
54
55
|
# don't need strict for internal tests
|
|
55
|
-
mypy
|
|
56
|
+
mypy tests
|
|
56
57
|
|
|
57
|
-
#
|
|
58
|
-
mypy --
|
|
58
|
+
# tests that support --strict
|
|
59
|
+
mypy --strict examples/test_example_mypy.py
|
|
60
|
+
|
|
61
|
+
# considering ways to make sure this fails
|
|
62
|
+
# mypy --strict examples/test_example_mypy_fail.py
|
|
59
63
|
|
|
60
64
|
# for most examples, I'd like to not use all type hints to aid in readability
|
|
61
65
|
; --strict # mostly strict
|
|
@@ -66,7 +70,7 @@ commands =
|
|
|
66
70
|
--allow-untyped-defs \
|
|
67
71
|
--disable-error-code=comparison-overlap \
|
|
68
72
|
--disable-error-code=no-untyped-call \
|
|
69
|
-
examples
|
|
73
|
+
examples --exclude examples/test_example_mypy_fail.py
|
|
70
74
|
description = Run mypy over src, test, examples
|
|
71
75
|
|
|
72
76
|
[pytest]
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import Any, Callable
|
|
4
|
-
|
|
5
|
-
from .context_manager import CheckContextManager as _BaseCheck
|
|
6
|
-
from .check_functions import (
|
|
7
|
-
assert_equal,
|
|
8
|
-
equal,
|
|
9
|
-
not_equal,
|
|
10
|
-
is_,
|
|
11
|
-
is_not,
|
|
12
|
-
is_true,
|
|
13
|
-
is_false,
|
|
14
|
-
is_none,
|
|
15
|
-
is_not_none,
|
|
16
|
-
is_nan,
|
|
17
|
-
is_not_nan,
|
|
18
|
-
is_in,
|
|
19
|
-
is_not_in,
|
|
20
|
-
is_instance,
|
|
21
|
-
is_not_instance,
|
|
22
|
-
almost_equal,
|
|
23
|
-
not_almost_equal,
|
|
24
|
-
greater,
|
|
25
|
-
greater_equal,
|
|
26
|
-
less,
|
|
27
|
-
less_equal,
|
|
28
|
-
between,
|
|
29
|
-
between_equal,
|
|
30
|
-
check_func,
|
|
31
|
-
fail,
|
|
32
|
-
)
|
|
33
|
-
from .check_raises import raises
|
|
34
|
-
from .check_log import any_failures
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
class CheckType(_BaseCheck):
|
|
38
|
-
# Helper functions exposed as attributes on the check object
|
|
39
|
-
assert_equal: Callable[..., None]
|
|
40
|
-
equal: Callable[..., bool]
|
|
41
|
-
not_equal: Callable[..., bool]
|
|
42
|
-
is_: Callable[..., bool]
|
|
43
|
-
is_not: Callable[..., bool]
|
|
44
|
-
is_true: Callable[..., bool]
|
|
45
|
-
is_false: Callable[..., bool]
|
|
46
|
-
is_none: Callable[..., bool]
|
|
47
|
-
is_not_none: Callable[..., bool]
|
|
48
|
-
is_nan: Callable[..., bool]
|
|
49
|
-
is_not_nan: Callable[..., bool]
|
|
50
|
-
is_in: Callable[..., bool]
|
|
51
|
-
is_not_in: Callable[..., bool]
|
|
52
|
-
is_instance: Callable[..., bool]
|
|
53
|
-
is_not_instance: Callable[..., bool]
|
|
54
|
-
almost_equal: Callable[..., bool]
|
|
55
|
-
not_almost_equal: Callable[..., bool]
|
|
56
|
-
greater: Callable[..., bool]
|
|
57
|
-
greater_equal: Callable[..., bool]
|
|
58
|
-
less: Callable[..., bool]
|
|
59
|
-
less_equal: Callable[..., bool]
|
|
60
|
-
between: Callable[..., bool]
|
|
61
|
-
between_equal: Callable[..., bool]
|
|
62
|
-
check_func: Callable[..., Callable[..., bool]]
|
|
63
|
-
fail: Callable[..., None]
|
|
64
|
-
|
|
65
|
-
# Extra helpers attached in __init__.py
|
|
66
|
-
raises: Callable[..., Any]
|
|
67
|
-
any_failures: Callable[..., bool]
|
|
68
|
-
|
|
69
|
-
# Some users do check.check, so keep it typed
|
|
70
|
-
check: "CheckType"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
check: CheckType
|
|
74
|
-
|
|
75
|
-
__all__ = [
|
|
76
|
-
# main interface objects
|
|
77
|
-
"check",
|
|
78
|
-
"raises",
|
|
79
|
-
"any_failures",
|
|
80
|
-
# helper functions available as module attributes
|
|
81
|
-
"assert_equal",
|
|
82
|
-
"equal",
|
|
83
|
-
"not_equal",
|
|
84
|
-
"is_",
|
|
85
|
-
"is_not",
|
|
86
|
-
"is_true",
|
|
87
|
-
"is_false",
|
|
88
|
-
"is_none",
|
|
89
|
-
"is_not_none",
|
|
90
|
-
"is_nan",
|
|
91
|
-
"is_not_nan",
|
|
92
|
-
"is_in",
|
|
93
|
-
"is_not_in",
|
|
94
|
-
"is_instance",
|
|
95
|
-
"is_not_instance",
|
|
96
|
-
"almost_equal",
|
|
97
|
-
"not_almost_equal",
|
|
98
|
-
"greater",
|
|
99
|
-
"greater_equal",
|
|
100
|
-
"less",
|
|
101
|
-
"less_equal",
|
|
102
|
-
"between",
|
|
103
|
-
"between_equal",
|
|
104
|
-
"check_func",
|
|
105
|
-
"fail",
|
|
106
|
-
]
|
|
107
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_fail_in_teardown_with_skip.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytest_check-2.7.4 → pytest_check-2.7.6}/examples/test_example_mix_checks_and_assertions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|