testtools 2.8.4__tar.gz → 2.8.7__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.
- {testtools-2.8.4 → testtools-2.8.7}/NEWS +37 -2
- {testtools-2.8.4 → testtools-2.8.7}/PKG-INFO +2 -2
- {testtools-2.8.4 → testtools-2.8.7}/README.rst +1 -1
- {testtools-2.8.4 → testtools-2.8.7}/pyproject.toml +1 -1
- {testtools-2.8.4 → testtools-2.8.7}/tests/test_testsuite.py +17 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/_version.py +2 -2
- {testtools-2.8.4 → testtools-2.8.7}/testtools/testcase.py +56 -33
- {testtools-2.8.4 → testtools-2.8.7}/testtools/testsuite.py +4 -4
- {testtools-2.8.4 → testtools-2.8.7}/.git-blame-ignore-revs +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/.github/dependabot.yaml +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/.github/workflows/publish.yml +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/.github/workflows/test.yml +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/.gitignore +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/.gitreview +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/.testr.conf +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/LICENSE +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/MANIFEST.in +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/Makefile +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/disperse.conf +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/doc/Makefile +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/doc/_static/placeholder.txt +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/doc/_templates/placeholder.txt +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/doc/api.rst +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/doc/conf.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/doc/for-framework-folk.rst +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/doc/for-test-authors.rst +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/doc/hacking.rst +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/doc/index.rst +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/doc/make.bat +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/doc/news.rst +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/doc/overview.rst +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/doc/twisted-support.rst +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/readthedocs-requirements.txt +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/requirements.txt +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/scripts/README +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/scripts/all-pythons +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/scripts/update-rtfd +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/__init__.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/helpers.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/matchers/__init__.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/matchers/test_basic.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/matchers/test_const.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/matchers/test_datastructures.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/matchers/test_dict.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/matchers/test_doctest.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/matchers/test_exception.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/matchers/test_filesystem.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/matchers/test_higherorder.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/matchers/test_impl.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/matchers/test_warnings.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/samplecases.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/test_assert_that.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/test_compat.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/test_content.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/test_content_type.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/test_fixturesupport.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/test_helpers.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/test_monkey.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/test_run.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/test_runtest.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/test_tags.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/test_testcase.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/test_testresult.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/test_with_with.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/twistedsupport/__init__.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/twistedsupport/_helpers.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/twistedsupport/test_deferred.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/twistedsupport/test_matchers.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/twistedsupport/test_runtest.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tests/twistedsupport/test_spinner.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/__init__.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/_version.pyi +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/assertions.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/compat.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/content.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/content_type.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/helpers.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/matchers/__init__.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/matchers/_basic.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/matchers/_const.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/matchers/_datastructures.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/matchers/_dict.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/matchers/_doctest.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/matchers/_exception.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/matchers/_filesystem.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/matchers/_higherorder.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/matchers/_impl.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/matchers/_warnings.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/matchers/test.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/monkey.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/py.typed +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/run.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/runtest.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/tags.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/testresult/__init__.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/testresult/doubles.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/testresult/real.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/tests/__init__.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/tests/helpers.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/tests/matchers/__init__.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/tests/matchers/helpers.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/twistedsupport/__init__.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/twistedsupport/_deferred.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/twistedsupport/_deferreddebug.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/twistedsupport/_matchers.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/twistedsupport/_runtest.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/testtools/twistedsupport/_spinner.py +0 -0
- {testtools-2.8.4 → testtools-2.8.7}/tox.ini +0 -0
|
@@ -3,6 +3,42 @@ testtools NEWS
|
|
|
3
3
|
|
|
4
4
|
Changes and improvements to testtools_, grouped by release.
|
|
5
5
|
|
|
6
|
+
NEXT
|
|
7
|
+
~~~~
|
|
8
|
+
|
|
9
|
+
2.8.7
|
|
10
|
+
~~~~~
|
|
11
|
+
|
|
12
|
+
Improvements
|
|
13
|
+
------------
|
|
14
|
+
* Fix an issue with ``iterate_tests``, which was recently changes to insist
|
|
15
|
+
on accepting an instance of ``unittest.TestSuite``, breaking some users.
|
|
16
|
+
(Jelmer Vernooij, #584)
|
|
17
|
+
|
|
18
|
+
* Improve the type annotations for ``testtools.testcase.TestCase.skipTest``
|
|
19
|
+
(Stephen Finucane, #585)
|
|
20
|
+
|
|
21
|
+
* Correct a URL in the README
|
|
22
|
+
(Steve Kowalik, #582)
|
|
23
|
+
|
|
24
|
+
2.8.6
|
|
25
|
+
~~~~~
|
|
26
|
+
|
|
27
|
+
Improvements
|
|
28
|
+
------------
|
|
29
|
+
* Improve the type annotations for ``testtools.testcase.TestCase.assertRaises``.
|
|
30
|
+
This method will now be typed correctly when called as a method or as a
|
|
31
|
+
context manager.
|
|
32
|
+
(Stephen Finucane, #577, #578)
|
|
33
|
+
|
|
34
|
+
2.8.5
|
|
35
|
+
~~~~~
|
|
36
|
+
|
|
37
|
+
Improvements
|
|
38
|
+
------------
|
|
39
|
+
* Fix the type annotations for ``testtools.testcase.TestCase.useFixture``
|
|
40
|
+
(Stephen Finucane, #574)
|
|
41
|
+
|
|
6
42
|
2.8.4
|
|
7
43
|
~~~~~
|
|
8
44
|
|
|
@@ -70,8 +106,7 @@ Improvements
|
|
|
70
106
|
(Jelmer Vernooij, #538)
|
|
71
107
|
|
|
72
108
|
* Allow stream=None to be passed to various TestResult
|
|
73
|
-
classes that now support verbosity; fixes a regression
|
|
74
|
-
from 2.8.0.
|
|
109
|
+
classes that now support verbosity; fixes a regression from 2.8.0.
|
|
75
110
|
(Jelmer Vernooij)
|
|
76
111
|
|
|
77
112
|
2.8.1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: testtools
|
|
3
|
-
Version: 2.8.
|
|
3
|
+
Version: 2.8.7
|
|
4
4
|
Summary: Extensions to the Python standard library unit testing framework
|
|
5
5
|
Project-URL: Homepage, https://github.com/testing-cabal/testtools
|
|
6
6
|
Author-email: "Jonathan M. Lange" <jml+testtools@mumak.net>
|
|
@@ -26,7 +26,7 @@ Classifier: Typing :: Typed
|
|
|
26
26
|
Requires-Python: >=3.10
|
|
27
27
|
Provides-Extra: dev
|
|
28
28
|
Requires-Dist: mypy>=1.0.0; extra == 'dev'
|
|
29
|
-
Requires-Dist: ruff==0.
|
|
29
|
+
Requires-Dist: ruff==0.15.5; extra == 'dev'
|
|
30
30
|
Requires-Dist: typing-extensions; (python_version < '3.11') and extra == 'dev'
|
|
31
31
|
Provides-Extra: test
|
|
32
32
|
Requires-Dist: testresources; extra == 'test'
|
|
@@ -51,7 +51,7 @@ If you would like to use our Twisted support, then you will need the
|
|
|
51
51
|
``testtools[twisted]`` extra.
|
|
52
52
|
|
|
53
53
|
If you want to use ``fixtures`` then you can either install fixtures (e.g. from
|
|
54
|
-
https://github.com/testing-
|
|
54
|
+
https://github.com/testing-cabal/fixtures or https://pypi.python.org/pypi/fixtures)
|
|
55
55
|
or alternatively just make sure your fixture objects obey the same protocol.
|
|
56
56
|
|
|
57
57
|
|
|
@@ -387,6 +387,23 @@ class TestFixtureSuite(TestCase):
|
|
|
387
387
|
self.assertRaises(ValueError, suite.sort_tests)
|
|
388
388
|
|
|
389
389
|
|
|
390
|
+
class TestIterateTests(TestCase):
|
|
391
|
+
def test_iterate_suite(self):
|
|
392
|
+
a = PlaceHolder("a")
|
|
393
|
+
b = PlaceHolder("b")
|
|
394
|
+
suite = unittest.TestSuite([a, b]) # type: ignore[list-item]
|
|
395
|
+
self.assertEqual([a, b], list(iterate_tests(suite)))
|
|
396
|
+
|
|
397
|
+
def test_iterate_single_test(self):
|
|
398
|
+
a = PlaceHolder("a")
|
|
399
|
+
self.assertEqual([a], list(iterate_tests(a)))
|
|
400
|
+
|
|
401
|
+
def test_iterate_list(self):
|
|
402
|
+
a = PlaceHolder("a")
|
|
403
|
+
b = PlaceHolder("b")
|
|
404
|
+
self.assertEqual([a, b], list(iterate_tests([a, b])))
|
|
405
|
+
|
|
406
|
+
|
|
390
407
|
class TestSortedTests(TestCase):
|
|
391
408
|
def test_sorts_custom_suites(self):
|
|
392
409
|
a = PlaceHolder("a")
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
# This file is automatically generated by hatch.
|
|
2
|
-
version = '2.8.
|
|
3
|
-
__version__ = (2, 8,
|
|
2
|
+
version = '2.8.7'
|
|
3
|
+
__version__ = (2, 8, 7)
|
|
@@ -23,7 +23,7 @@ import sys
|
|
|
23
23
|
import types
|
|
24
24
|
import unittest
|
|
25
25
|
from collections.abc import Callable, Iterator
|
|
26
|
-
from typing import
|
|
26
|
+
from typing import TYPE_CHECKING, NoReturn, ParamSpec, TypeVar, cast, overload
|
|
27
27
|
from unittest.case import SkipTest
|
|
28
28
|
|
|
29
29
|
T = TypeVar("T")
|
|
@@ -56,6 +56,20 @@ from testtools.testresult import (
|
|
|
56
56
|
TestResult,
|
|
57
57
|
)
|
|
58
58
|
|
|
59
|
+
if TYPE_CHECKING:
|
|
60
|
+
if sys.version_info >= (3, 11):
|
|
61
|
+
from typing import Self
|
|
62
|
+
else:
|
|
63
|
+
from typing_extensions import Self
|
|
64
|
+
|
|
65
|
+
# Circular import: fixtures imports gather_details from here, we import
|
|
66
|
+
# fixtures, leading to gather_details not being available and fixtures being
|
|
67
|
+
# unable to import it.
|
|
68
|
+
try:
|
|
69
|
+
import fixtures
|
|
70
|
+
except ImportError:
|
|
71
|
+
fixtures = None # type: ignore
|
|
72
|
+
|
|
59
73
|
|
|
60
74
|
class _UnexpectedSuccess(Exception):
|
|
61
75
|
"""An unexpected success was raised.
|
|
@@ -74,6 +88,8 @@ class _ExpectedFailure(Exception):
|
|
|
74
88
|
|
|
75
89
|
|
|
76
90
|
# TypeVar for decorators
|
|
91
|
+
_P = ParamSpec("_P")
|
|
92
|
+
_R = TypeVar("_R")
|
|
77
93
|
_F = TypeVar("_F", bound=Callable[..., object])
|
|
78
94
|
|
|
79
95
|
|
|
@@ -183,22 +199,7 @@ def gather_details(source_dict: DetailsDict, target_dict: DetailsDict) -> None:
|
|
|
183
199
|
target_dict[name] = _copy_content(content_object)
|
|
184
200
|
|
|
185
201
|
|
|
186
|
-
|
|
187
|
-
# fixtures, leading to gather_details not being available and fixtures being
|
|
188
|
-
# unable to import it.
|
|
189
|
-
try:
|
|
190
|
-
import fixtures
|
|
191
|
-
except ImportError:
|
|
192
|
-
fixtures = None # type: ignore
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
class UseFixtureProtocol(Protocol):
|
|
196
|
-
def setUp(self) -> None: ...
|
|
197
|
-
def cleanUp(self) -> None: ...
|
|
198
|
-
def getDetails(self) -> DetailsDict: ...
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
UseFixtureT = TypeVar("UseFixtureT", bound=UseFixtureProtocol)
|
|
202
|
+
FixtureT = TypeVar("FixtureT", bound="fixtures.Fixture")
|
|
202
203
|
|
|
203
204
|
|
|
204
205
|
def _mods(i: int, mod: int) -> Iterator[int]:
|
|
@@ -365,7 +366,7 @@ class TestCase(unittest.TestCase):
|
|
|
365
366
|
def shortDescription(self) -> str:
|
|
366
367
|
return self.id()
|
|
367
368
|
|
|
368
|
-
def skipTest(self, reason: str) ->
|
|
369
|
+
def skipTest(self, reason: str) -> NoReturn:
|
|
369
370
|
"""Cause this test to be skipped.
|
|
370
371
|
|
|
371
372
|
This raises self.skipException(reason). skipException is raised
|
|
@@ -391,10 +392,10 @@ class TestCase(unittest.TestCase):
|
|
|
391
392
|
|
|
392
393
|
def addCleanup(
|
|
393
394
|
self,
|
|
394
|
-
function: Callable[
|
|
395
|
+
function: Callable[_P, _R],
|
|
395
396
|
/,
|
|
396
|
-
*
|
|
397
|
-
**
|
|
397
|
+
*args: _P.args,
|
|
398
|
+
**kwargs: _P.kwargs,
|
|
398
399
|
) -> None:
|
|
399
400
|
"""Add a cleanup function to be called after tearDown.
|
|
400
401
|
|
|
@@ -408,7 +409,7 @@ class TestCase(unittest.TestCase):
|
|
|
408
409
|
Cleanup functions are always called before a test finishes running,
|
|
409
410
|
even if setUp is aborted by an exception.
|
|
410
411
|
"""
|
|
411
|
-
self._cleanups.append((function,
|
|
412
|
+
self._cleanups.append((function, args, kwargs))
|
|
412
413
|
|
|
413
414
|
def addOnException(self, handler: "Callable[[ExcInfo], None]") -> None:
|
|
414
415
|
"""Add a handler to be called when an exception occurs in test code.
|
|
@@ -500,12 +501,28 @@ class TestCase(unittest.TestCase):
|
|
|
500
501
|
matcher = IsInstance(klass)
|
|
501
502
|
self.assertThat(obj, matcher, msg or "")
|
|
502
503
|
|
|
504
|
+
@overload # type: ignore[override]
|
|
505
|
+
def assertRaises(
|
|
506
|
+
self,
|
|
507
|
+
expected_exception: type[BaseException] | tuple[type[BaseException]],
|
|
508
|
+
callable: Callable[_P, _R],
|
|
509
|
+
*args: _P.args,
|
|
510
|
+
**kwargs: _P.kwargs,
|
|
511
|
+
) -> BaseException: ...
|
|
512
|
+
|
|
513
|
+
@overload # type: ignore[override]
|
|
514
|
+
def assertRaises(
|
|
515
|
+
self,
|
|
516
|
+
expected_exception: type[BaseException] | tuple[type[BaseException]],
|
|
517
|
+
callable: None = ...,
|
|
518
|
+
) -> "_AssertRaisesContext": ...
|
|
519
|
+
|
|
503
520
|
def assertRaises( # type: ignore[override]
|
|
504
521
|
self,
|
|
505
|
-
expected_exception: type[BaseException],
|
|
506
|
-
callable: Callable[
|
|
507
|
-
*args:
|
|
508
|
-
**kwargs:
|
|
522
|
+
expected_exception: type[BaseException] | tuple[type[BaseException]],
|
|
523
|
+
callable: Callable[_P, _R] | None = None,
|
|
524
|
+
*args: _P.args,
|
|
525
|
+
**kwargs: _P.kwargs,
|
|
509
526
|
) -> "_AssertRaisesContext | BaseException":
|
|
510
527
|
"""Fail unless an exception of class expected_exception is thrown
|
|
511
528
|
by callable when invoked with arguments args and keyword
|
|
@@ -661,9 +678,9 @@ class TestCase(unittest.TestCase):
|
|
|
661
678
|
def expectFailure(
|
|
662
679
|
self,
|
|
663
680
|
reason: str,
|
|
664
|
-
predicate: Callable[
|
|
665
|
-
*args:
|
|
666
|
-
**kwargs:
|
|
681
|
+
predicate: Callable[_P, _R],
|
|
682
|
+
*args: _P.args,
|
|
683
|
+
**kwargs: _P.kwargs,
|
|
667
684
|
) -> None:
|
|
668
685
|
"""Check that a test fails in a particular way.
|
|
669
686
|
|
|
@@ -892,7 +909,7 @@ class TestCase(unittest.TestCase):
|
|
|
892
909
|
"""
|
|
893
910
|
return self._get_test_method()()
|
|
894
911
|
|
|
895
|
-
def useFixture(self, fixture:
|
|
912
|
+
def useFixture(self, fixture: "FixtureT") -> "FixtureT":
|
|
896
913
|
"""Use fixture in a test case.
|
|
897
914
|
|
|
898
915
|
The fixture will be setUp, and self.addCleanup(fixture.cleanUp) called.
|
|
@@ -1213,7 +1230,10 @@ class _AssertRaisesContext:
|
|
|
1213
1230
|
"""
|
|
1214
1231
|
|
|
1215
1232
|
def __init__(
|
|
1216
|
-
self,
|
|
1233
|
+
self,
|
|
1234
|
+
expected: type[BaseException] | tuple[type[BaseException]],
|
|
1235
|
+
test_case: TestCase,
|
|
1236
|
+
msg: str | None = None,
|
|
1217
1237
|
) -> None:
|
|
1218
1238
|
"""Construct an `_AssertRaisesContext`.
|
|
1219
1239
|
|
|
@@ -1226,7 +1246,7 @@ class _AssertRaisesContext:
|
|
|
1226
1246
|
self.msg = msg
|
|
1227
1247
|
self.exception: BaseException | None = None
|
|
1228
1248
|
|
|
1229
|
-
def __enter__(self) -> "
|
|
1249
|
+
def __enter__(self) -> "Self":
|
|
1230
1250
|
return self
|
|
1231
1251
|
|
|
1232
1252
|
def __exit__(
|
|
@@ -1329,7 +1349,10 @@ class Nullary:
|
|
|
1329
1349
|
"""
|
|
1330
1350
|
|
|
1331
1351
|
def __init__(
|
|
1332
|
-
self,
|
|
1352
|
+
self,
|
|
1353
|
+
callable_object: Callable[_P, _R],
|
|
1354
|
+
*args: _P.args,
|
|
1355
|
+
**kwargs: _P.kwargs,
|
|
1333
1356
|
) -> None:
|
|
1334
1357
|
self._callable_object = callable_object
|
|
1335
1358
|
self._args = args
|
|
@@ -58,13 +58,13 @@ def iterate_tests(
|
|
|
58
58
|
test_suite_or_case: TestSuiteOrCase,
|
|
59
59
|
) -> Generator[unittest.TestCase, None, None]:
|
|
60
60
|
"""Iterate through all of the test cases in 'test_suite_or_case'."""
|
|
61
|
-
if isinstance(test_suite_or_case,
|
|
62
|
-
|
|
61
|
+
if isinstance(test_suite_or_case, Iterable) and not isinstance(
|
|
62
|
+
test_suite_or_case, unittest.TestCase
|
|
63
|
+
):
|
|
63
64
|
for test in test_suite_or_case:
|
|
64
65
|
yield from iterate_tests(test)
|
|
65
66
|
else:
|
|
66
|
-
#
|
|
67
|
-
yield test_suite_or_case
|
|
67
|
+
yield test_suite_or_case # type: ignore[misc]
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
class ConcurrentTestSuite(unittest.TestSuite):
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|