Sebastian Rittau
fdc195465b
Add tests for TestCase.assertDictEqual() ( #11154 )
2023-12-12 16:41:18 +01:00
Alex Waygood
10febc4fe0
stdlib: remove unused type: ignore comments ( #11061 )
2023-11-23 14:00:07 +01:00
Alex Waygood
83964a4dc5
stdlib: add many missing __del__ methods ( #11042 )
2023-11-18 11:32:12 -08:00
Alex Waygood
eebc28740e
Revert "Use Callable[..., Any] instead of Callable[..., object] in unittest" ( #8779 )
2023-11-10 19:53:33 +01:00
Rob Percival
cc0b41a994
Fix type hints for unittest.util.unorderable_list_difference() ( #11012 )
...
Fix type hints for unorderable_list_difference()
It claimed that the arguments were `Sequence` types (immutable), but the function removes elements from them, so they must be `MutableSequence` types. Specifically, it calls `pop()` on the first argument and `remove()` on the second argument.
See the function implementation for details:
0b06d2482d/Lib/unittest/util.py (L98-L113)
2023-11-10 17:53:03 +00:00
Jelle Zijlstra
3229b36644
stdlib: More pos-only parameters to Protocols ( #10987 )
2023-11-06 23:45:12 +01:00
Imogen
b76b2afdf3
Fix typings for unittest.TestCase.assertLessEqual ( #10798 )
2023-09-29 01:03:20 +02:00
Nikita Sobolev
f0ba5ba2a2
Update unittest.mock to 3.12 ( #10650 )
...
And harmonise some annotations between the stdlib `unittest.mock` module and the third-party `mock` backport package.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com >
2023-09-02 15:03:39 +01:00
Nikita Sobolev
6c2c164de2
unittest: py312 updates for load_tests and loadTestsFromModule (#10640 )
2023-08-30 12:27:40 +01:00
Nikita Sobolev
c9583d9f14
Add durations to unittest in 3.12 ( #10636 )
2023-08-30 11:35:25 +01:00
Nikita Sobolev
032f9195f9
Add a more precise signature for AsyncMock.reset_mock() ( #10481 )
2023-07-19 13:25:20 +01:00
Alex Waygood
03b4bb9cce
Stdlib: add many missing __hash__ and __eq__ methods ( #10464 )
2023-07-17 14:21:02 +02:00
Sebastian Rittau
7ea173c4ad
Fix @patch when new is missing ( #10459 )
2023-07-14 12:53:13 +02:00
Shantanu
9e86c6026a
unittest.mock: use ParamSpec in patch ( #10325 )
...
Fixes #10324
2023-06-20 13:48:49 +02:00
Lucina
41b8981368
unittest.mock.__version__ was removed in 3.9 ( #10056 )
...
See the first entry in https://docs.python.org/3/whatsnew/3.9.html#removed
2023-04-17 11:51:34 -06:00
Alex Waygood
dd2818a41d
Stdlib: add container default values ( #9909 )
2023-03-21 09:12:34 +01:00
Alex Waygood
257e287fec
Stdlib: correct many parameter names ( #9815 )
2023-03-04 09:53:12 +00:00
Alex Waygood
6ba28ae547
Remove unused type: ignore comments ( #9801 )
2023-02-23 12:59:50 -08:00
Alex Waygood
4273a83bb7
unittest: Use a recursive type alias for assertIsInstance (#9770 )
2023-02-20 15:35:50 +00:00
Avasam
140bba3425
Add comments when subclassing Any ( #9732 )
2023-02-14 14:11:56 +01:00
Avasam
a768744d51
Type and mark as final module-level dunders not meant to be overwritten in stdlib/ ( #9709 )
2023-02-12 16:15:20 +00:00
Alex Waygood
9ed39d8796
Use typing_extensions.Self in the stdlib ( #9694 )
2023-02-09 09:12:13 +00:00
Alex Waygood
0ef9c3f8e8
Enable flake8-pyi's Y037 ( #9686 )
2023-02-06 19:01:02 -08:00
Alex Waygood
33a62ae42d
Add more defaults to the stdlib ( #9606 )
...
Continuing work towards #8988 .
The first five commits were created using stubdefaulter on various Python versions; the following commits were all created manually by me to fix various problems. The main things this adds that weren't present in #9501 are:
- Defaults in Windows-only modules and Windows-only branches (because I'm running a Windows machine)
- Defaults in non-py311 branches
- Defaults for float parameters
- Defaults for overloads
2023-01-29 01:51:23 +00:00
Jelle Zijlstra
ddfaca3200
stdlib: add argument default values ( #9501 )
2023-01-18 09:37:34 +01:00
Alex Waygood
352f496d69
Unpin stubtest from Python 3.10.8 and 3.11.0 ( #9368 )
2022-12-20 20:31:13 +00:00
Terrance
4661af99c3
Annotate unittest.TestCase.skipTest() as no-return ( #9352 )
...
Annotate unittest.TestCase.skipTest() as no-return
This method unconditionally raises unittest.SkipTest, which ends a test
method early. unittest.TestCase.fail() works similarly, and is already
annotated with NoReturn to indicate this behaviour.
2022-12-11 18:07:09 +00:00
Nikita Sobolev
18e2ae762b
Mark first argument of __[get|set|del]attr__ as str ( #9245 )
2022-11-22 11:06:50 +00:00
Jelle Zijlstra
1f7648976c
unittest: cannot use bytes regexes ( #9107 )
...
```
>>> from unittest.case import TestCase
>>> c = TestCase()
>>> with c.assertRaisesRegex(Exception, b"x"): 1/0
...
ZeroDivisionError: division by zero
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/unittest/case.py", line 274, in __exit__
if not expected_regex.search(str(exc_value)):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: cannot use a bytes pattern on a string-like object
```
2022-11-05 14:14:53 -07:00
Sebastian Rittau
e7e94dd101
Make unittest.patch.* methods static ( #7543 )
2022-11-01 13:09:56 +01:00
Nikita Sobolev
380022c650
Remove empty __init__ methods ( #8816 )
2022-09-30 13:08:41 +01:00
Shane Harvey
1a2914adc5
Use Callable[..., Any] instead of Callable[..., object] in unittest ( #8399 )
2022-09-21 13:46:38 +01:00
Pierre Riandey
70d76ecf8f
Add types for unittest.loader.TestLoader._match_path ( #8669 )
2022-09-02 09:55:24 +02:00
MapleCCC
dece0b1fff
assertRaises / assertRaisesRegex / assertWarns / assertWarnsRegex: msg argument is keyword-only (#8631 )
2022-08-27 15:55:14 +01:00
Nikita Sobolev
0259068ad6
Remove duplicate definitions in sub-classes ( #8594 )
2022-08-26 17:10:55 +02:00
Nikita Sobolev
0480550fc3
Adds missing __dir__ definitions ( #8479 )
2022-08-04 12:21:43 +02:00
Shane Harvey
7a73660f3f
Fix hints for TestCase.assertRaises ( #8373 )
2022-07-23 10:43:38 +01:00
Alex Waygood
35616b439f
Run pycln as a pre-commit hook in CI ( #8304 )
2022-07-18 09:27:28 +02:00
Alex Waygood
6348a58b8b
Import Match and Pattern from re, not typing ( #8277 )
2022-07-12 15:32:48 +02:00
Alex Waygood
edc0ecd857
Remove Python 3.6 branches from typeshed ( #8269 )
2022-07-11 10:55:17 +02:00
Alex Waygood
fffb25201a
Delete some works of fiction ( #8247 )
2022-07-06 22:49:18 +05:30
Alex Waygood
208d8e1ec2
Fix assertAlmostEqual regression on mixed numeric types ( #8137 )
2022-06-27 08:57:36 +02:00
Alex Waygood
8b3b6bf7cd
stdlib: Audit Callable[<parameters>, None] annotations ( #8187 )
2022-06-27 08:08:28 +02:00
Alex Waygood
538621e91b
unittest.case: tighter annotations for various assertions (#8077 )
2022-06-20 18:49:57 +02:00
Alex Waygood
5add91d6bb
unittest: Improve self.assert(Not)AlmostEqual(s) (#8066 )
2022-06-14 18:24:51 +03:00
Alex Waygood
b88ea4a499
Simplify __all__ for unittest and xml.etree ( #8029 )
2022-06-07 12:03:52 -07:00
Alex Waygood
43a9ab08d7
Always use TypeAlias when assigning to Any ( #8021 )
2022-06-05 18:16:20 -07:00
Alex Waygood
0ce825b5a8
Add unittest features new in Python 3.11 ( #8020 )
...
python/cpython@086c6b1
2022-06-04 16:27:52 +01:00
Alex Waygood
acc0167dc1
Fix several new-in-3.11 stubtest errors ( #7973 )
2022-06-02 18:07:38 -07:00
Jelle Zijlstra
66383ee8e3
unittest.mock: target must be a str ( #7672 )
...
See [the CPython source](eaa85cb22f/Lib/unittest/mock.py (L1754) ). It calls `_get_target`, and [that](eaa85cb22f/Lib/unittest/mock.py (L1594) ) does `target.rsplit('.', 1)`.
2022-04-21 14:07:55 -07:00