Commit Graph

32 Commits

Author SHA1 Message Date
Alex Waygood
b53843ab46 Add infrastructure allowing for test cases for third-party stubs (#8700)
- Move the logic for running mypy on the test cases from `tests/mypy_test.py` to a separate script, `tests/regr_test.py`.
- Add the necessary logic in order to be able to have test cases for third-party stubs.
- Move logic common to `tests/mypy_test.py` and `tests/regr_test.py` into `tests/colors.py`, and rename `tests/colors.py` to `tests/utils.py`.
- Add a new check to `tests/check_consistent.py`, to enforce the use of `# pyright: reportUnnecessaryTypeIgnoreComment=true` comments in third-party test cases. These are essential if we want to have our tests against false-negatives work with pyright.
- Update the relevant documentation to account for the new test file.
- Add a new job to the `tests.yml` GitHub workflow, to run the new test in CI.
- Add a simple proof-of-concept test case for `requests`, as a regression test for #7998.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2022-09-08 16:51:33 +01:00
Alex Waygood
e2ef8fe116 test_cases README: Address post-merge review of #8688 (#8694)
Thanks @kkirsche for the review!
2022-09-06 17:00:57 +01:00
Alex Waygood
51e8325c10 Rename the files in the test_cases directory; add further clarifications to the README (#8688) 2022-09-06 07:50:24 +02:00
Alex Waygood
fd4feba2c9 Enable pyright's reportUnnecessaryTypeIgnoreComment setting for the whole test_cases directory (#8683) 2022-09-05 15:20:04 +02:00
Alex Waygood
8a326dc9ec Remove NoReturn overloads from pow() (#8568) 2022-08-19 11:15:07 -07:00
Alex Waygood
5b47f13a99 Add _threading_local.local.__delattr__ back to the stub (#8526) 2022-08-15 11:56:31 +02:00
Nikita Sobolev
d53d3258b2 Add "Naming convention" to test_cases/README.md (#8521)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-08-12 20:15:23 -07:00
Nikita Sobolev
510feeb3fc Improve constructor for builtins.dict (#8517)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-08-10 19:04:07 +01:00
Nikita Sobolev
266fed2f83 Consistent naming of files in the test_cases directory (#8520) 2022-08-10 10:33:42 +01:00
Alex Waygood
59a9621554 test_cases README: fix typos (#8453)
Both introduced in #8445
2022-07-31 23:11:13 +01:00
Alex Waygood
935ac9ca9e test_cases: Improve README (#8445) 2022-07-30 18:40:56 +01:00
Alex Waygood
e156c63bdb inspect, asyncio: Use more TypeGuards (#8057) 2022-07-18 19:49:12 -07:00
Alex Waygood
1ebe1b463e Fix asyncio.gather regression (#8271)
Adding the empty-tuple overload caused major problems for pyright, and that overload only deals with an unlikely edge case anyway. Get rid of it, and replace the fallback overload with a more general overload.

Fixes #8270.
2022-07-16 18:56:58 +01:00
Akuli
3c90c97b9a List[Foo] + List[Bar] now returns List[Foo | Bar] (#8293)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-07-15 20:20:50 +03:00
Alex Waygood
a1af16bda5 fractions.pyi: Correct dunder parameter names (#8285)
This wasn't possible prior to #8280, which disabled pyright's reportSelfClsParameterName check
2022-07-12 22:40:48 +01:00
Jelle Zijlstra
2a7439e106 Revert "add overload to tuple.__new__ to better express an empty tuple" (#8278)
This reverts commit 64554bdd5d.

Also add a test case.
2022-07-12 12:29:37 -07:00
Alex Waygood
27db37240a Remove files that only exist on <=3.6, update a few comments (#8273) 2022-07-12 09:12:32 +02:00
Alex Waygood
e19073e871 Add a tiny bit more special-casing for sum (#8231) 2022-07-02 20:05:56 +01:00
Alex Waygood
208d8e1ec2 Fix assertAlmostEqual regression on mixed numeric types (#8137) 2022-06-27 08:57:36 +02:00
Alex Waygood
538621e91b unittest.case: tighter annotations for various assertions (#8077) 2022-06-20 18:49:57 +02:00
Alex Waygood
5fa31e6759 Remove mypy error codes from the test_cases directory (#8083) 2022-06-15 15:31:45 +01:00
Alex Waygood
5add91d6bb unittest: Improve self.assert(Not)AlmostEqual(s) (#8066) 2022-06-14 18:24:51 +03:00
Alex Waygood
1828ba2045 builtins.sum: Items in the iterable must support addition with int if no start value is given (#8000) 2022-06-13 11:25:38 +01:00
Alex Waygood
1aa5663f9e Add __setattr__ to logging.LogRecord (#8064) 2022-06-12 12:04:22 -07:00
Sebastian Rittau
214bf15dce Use "all +=" instead of duplicating the branches (#7865) 2022-06-07 13:32:19 +02:00
Jelle Zijlstra
c35ec8ba89 contextlib: Remove explicit base class from ExitStack (#7963)
Fixes #7961
2022-05-27 09:19:18 -07:00
Jelle Zijlstra
9660ee97ee codecs: add missing function, reflect runtime import * (#7918) 2022-05-22 16:06:21 -07:00
Shantanu
032787d867 builtins: accept old-style iterables to iter (#7817) 2022-05-10 09:06:31 +02:00
Alex Waygood
bb39bdfd30 Add test cases for pow that are meant to fail a type check (#7760) 2022-05-08 08:16:37 -07:00
Alex Waygood
c3ebc7e307 More improvements to pow stubs (#7737) 2022-04-28 10:49:29 -06:00
Jelle Zijlstra
02e0c98d62 Buffer support for re (#7679) 2022-04-23 18:28:35 -07:00
Alex Waygood
2773480d13 Add regression tests for builtins.pow and object.__reduce__ (#7663) 2022-04-21 21:17:37 -07:00