Commit Graph
80 Commits
Author SHA1 Message Date
Alex WaygoodandGitHub 352f496d69 Unpin stubtest from Python 3.10.8 and 3.11.0 (#9368) 2022-12-20 20:31:13 +00:00
TerranceandGitHub 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 SobolevandGitHub 18e2ae762b Mark first argument of __[get|set|del]attr__ as str (#9245) 2022-11-22 11:06:50 +00:00
Jelle ZijlstraandGitHub 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 RittauandGitHub e7e94dd101 Make unittest.patch.* methods static (#7543) 2022-11-01 13:09:56 +01:00
Nikita SobolevandGitHub 380022c650 Remove empty __init__ methods (#8816) 2022-09-30 13:08:41 +01:00
Shane HarveyandGitHub 1a2914adc5 Use Callable[..., Any] instead of Callable[..., object] in unittest (#8399) 2022-09-21 13:46:38 +01:00
Pierre RiandeyandGitHub 70d76ecf8f Add types for unittest.loader.TestLoader._match_path (#8669) 2022-09-02 09:55:24 +02:00
MapleCCCandGitHub dece0b1fff assertRaises / assertRaisesRegex / assertWarns / assertWarnsRegex: msg argument is keyword-only (#8631) 2022-08-27 15:55:14 +01:00
Nikita SobolevandGitHub 0259068ad6 Remove duplicate definitions in sub-classes (#8594) 2022-08-26 17:10:55 +02:00
Nikita SobolevandGitHub 0480550fc3 Adds missing __dir__ definitions (#8479) 2022-08-04 12:21:43 +02:00
Shane HarveyandGitHub 7a73660f3f Fix hints for TestCase.assertRaises (#8373) 2022-07-23 10:43:38 +01:00
Alex WaygoodandGitHub 35616b439f Run pycln as a pre-commit hook in CI (#8304) 2022-07-18 09:27:28 +02:00
Alex WaygoodandGitHub 6348a58b8b Import Match and Pattern from re, not typing (#8277) 2022-07-12 15:32:48 +02:00
Alex WaygoodandGitHub edc0ecd857 Remove Python 3.6 branches from typeshed (#8269) 2022-07-11 10:55:17 +02:00
Alex WaygoodandGitHub fffb25201a Delete some works of fiction (#8247) 2022-07-06 22:49:18 +05:30
Alex WaygoodandGitHub 208d8e1ec2 Fix assertAlmostEqual regression on mixed numeric types (#8137) 2022-06-27 08:57:36 +02:00
Alex WaygoodandGitHub 8b3b6bf7cd stdlib: Audit Callable[<parameters>, None] annotations (#8187) 2022-06-27 08:08:28 +02:00
Alex WaygoodandGitHub 538621e91b unittest.case: tighter annotations for various assertions (#8077) 2022-06-20 18:49:57 +02:00
Alex WaygoodandGitHub 5add91d6bb unittest: Improve self.assert(Not)AlmostEqual(s) (#8066) 2022-06-14 18:24:51 +03:00
Alex WaygoodandGitHub b88ea4a499 Simplify __all__ for unittest and xml.etree (#8029) 2022-06-07 12:03:52 -07:00
Alex WaygoodandGitHub 43a9ab08d7 Always use TypeAlias when assigning to Any (#8021) 2022-06-05 18:16:20 -07:00
Alex WaygoodandGitHub 0ce825b5a8 Add unittest features new in Python 3.11 (#8020)
python/cpython@086c6b1
2022-06-04 16:27:52 +01:00
Alex WaygoodandGitHub acc0167dc1 Fix several new-in-3.11 stubtest errors (#7973) 2022-06-02 18:07:38 -07:00
Jelle ZijlstraandGitHub 66383ee8e3 unittest.mock: target must be a str (#7672)
See [the CPython source](https://github.com/python/cpython/blob/eaa85cb22fa2d9e7cd31c2eac29a56cd3a8f2f65/Lib/unittest/mock.py#L1754). It calls `_get_target`, and [that](https://github.com/python/cpython/blob/eaa85cb22fa2d9e7cd31c2eac29a56cd3a8f2f65/Lib/unittest/mock.py#L1594) does `target.rsplit('.', 1)`.
2022-04-21 14:07:55 -07:00
Alex WaygoodandGitHub a8504f269e Use _typeshed.OptExcInfo in pydoc and unittest (#7668) 2022-04-20 21:00:48 +01:00
Alex WaygoodandGitHub b093c90a94 Use TypeAlias for type aliases where possible, part II (#7667) 2022-04-20 20:02:47 +01:00
Alex WaygoodandGitHub 97a74bc1aa Import from collections.abc wherever possible (#7635) 2022-04-18 12:50:37 +02:00
Alex WaygoodandGitHub 740193a8fc Use TypeAlias where possible for type aliases (#7630) 2022-04-15 18:01:00 -07:00
Alex WaygoodandGitHub da3e69d093 stdlib: Improve a bunch of __(a)exit__ methods (#7571) 2022-04-01 08:05:25 +02:00
Alex WaygoodandGitHub 1245bbcc8d Use type alias to simplify overloads in unittest.mock (#7563) 2022-03-29 08:19:26 +02:00
340c6c97ed Add mypy error codes to type: ignores, remove unused ignores (#7504)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-19 13:10:00 +00:00
Alex WaygoodandGitHub 3ab250eec8 Use PEP 604 syntax wherever possible (#7493) 2022-03-16 16:01:33 +01:00
Alex WaygoodandGitHub f4ae363b56 stdlib: correct many pos-or-kw arg names in dunder methods (#7451) 2022-03-07 16:40:03 +01:00
Itai SteinherzandGitHub b9909b121e Add missing typings to unittest.mock (#7431) 2022-03-06 15:43:39 -08:00
Alex WaygoodandGitHub 58e505eeb2 Add __all__ for modules beginning with 'u', 'x', 'w' and 'z' (#7374) 2022-02-23 23:04:21 +01:00
Adam JohnsonandGitHub 816f13339a Fix unittest.TextTestResult.printErrorList() (#7341) 2022-02-21 12:16:31 +02:00
Adam JohnsonandGitHub bd365f7093 Fix unittest.TextTestResult showAll name (#7340) 2022-02-21 11:33:45 +02:00
Alex WaygoodandGitHub 1f6c691322 Add missing dunder overrides in array, tracemalloc and unittest.mock (#7248) 2022-02-17 13:22:33 +01:00
Alex WaygoodandGitHub 5a8b9dafb3 Fix various py310 stubtest errors (#7239) 2022-02-16 11:47:49 -08:00
Alex WaygoodandGitHub fbc279e3f5 stdlib: Add many missing dunder overrides (#7231) 2022-02-16 06:25:47 -08:00
Alex WaygoodandGitHub f4967618dd Fix positional-only differences in many stdlib modules (#7226) 2022-02-15 15:14:06 +01:00
Alex WaygoodandGitHub 1371a1e1fe unittest deprecations have been deferred until 3.12 (#7131)
See https://github.com/python/cpython/pull/30935
2022-02-04 15:52:30 -08:00
Alex WaygoodandGitHub 7ccbbdb30a stdlib: Improve many __iter__ and constructor methods (#7112) 2022-02-02 19:14:57 +01:00
ShantanuandGitHub b88a6f19cd Upgrade black version (#7089) 2022-01-30 16:27:06 -08:00
45a2dad83c Reduce use of Any in equality methods (#7081)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2022-01-30 00:59:00 +02:00
Nikita SobolevandGitHub 20508d05f4 Use ParamSpec in unittest.case (#7012) 2022-01-25 10:25:28 +01:00
Nikita SobolevandGitHub dc176d70ec Use ParamSpec in unittest.async_case (#7011) 2022-01-23 13:54:06 -08:00
Jelle ZijlstraandGitHub de5ec6a0d1 fix incorrect tuple[T] (#6996)
Found from PyCQA/flake8-pyi#135.
2022-01-22 09:37:14 -08:00
Alex WaygoodandGitHub 7d33ff330a Clean up several version-dependent modules (#6885) 2022-01-10 05:57:08 -08:00