Miss Islington (bot)
01ab43c08a
[3.11] gh-117110: Fix subclasses of typing.Any with custom constructors (GH-117111) ( #117358 )
...
gh-117110: Fix subclasses of typing.Any with custom constructors (GH-117111)
(cherry picked from commit 8eec7ed714
)
Co-authored-by: 傅立业(Chris Fu) <17433201@qq.com>
2024-03-29 00:38:13 +00:00
Miss Islington (bot)
f187da5b59
[3.11] gh-116325: Raise `SyntaxError` rather than `IndexError` on ForwardRef with empty string arg (GH-116341) ( #116348 )
...
gh-116325: Raise `SyntaxError` rather than `IndexError` on ForwardRef with empty string arg (GH-116341)
(cherry picked from commit a29998a06b
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-03-05 10:15:54 +00:00
Nikita Sobolev
8bfbeeb0a1
[3.11] gh-112281: Allow `Union` with unhashable `Annotated` metadata (GH-112283) ( #116288 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-03-03 20:20:01 +00:00
Jelle Zijlstra
c01a4808d3
[3.11] gh-115570: Fix DeprecationWarnings in test_typing ( #115571 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-16 19:37:42 +00:00
Miss Islington (bot)
7542210a95
[3.11] gh-115165: Fix `typing.Annotated` for immutable types (GH-115213) ( #115228 )
...
gh-115165: Fix `typing.Annotated` for immutable types (GH-115213)
The return value from an annotated callable can raise any exception from
__setattr__ for the `__orig_class__` property.
(cherry picked from commit 564385612c
)
Co-authored-by: dave-shawley <daveshawley@gmail.com>
2024-02-09 22:43:24 +00:00
Miss Islington (bot)
db537702e4
[3.11] [3.12] gh-112618: Make Annotated cache typed (GH-112619) (GH-112628) ( #112633 )
...
[3.12] gh-112618: Make Annotated cache typed (GH-112619) (GH-112628)
(cherry picked from commit 2a378ca2ef
)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-12-03 00:58:13 +00:00
Miss Islington (bot)
f6edb83fe9
[3.11] gh-112509: Fix keys being present in both required_keys and optional_keys in TypedDict (GH-112512) ( #112531 )
...
(cherry picked from commit 4038869423
)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-11-29 17:51:00 +00:00
Nikita Sobolev
93fbcd6443
[3.11] gh-112155: Run `typing.py` doctests during tests (GH-112156) ( #112231 )
2023-11-18 11:13:55 +00:00
Nikita Sobolev
a60bbdee3a
[3.11] gh-108303: Move more typing related files to Lib/test/typinganndata (GH-111825) ( #111860 )
2023-11-08 17:19:47 +00:00
Miss Islington (bot)
9addf2cf11
[3.11] gh-111126: Use `isinstance` instead of `assert[Not]IsInstance` in `test_typing` (GH-111127) ( #111131 )
...
gh-111126: Use `isinstance` instead of `assert[Not]IsInstance` in `test_typing` (GH-111127)
(cherry picked from commit ea7c26e4b8
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-10-20 18:28:41 +00:00
Alex Waygood
3079aa3f5d
[3.11] Enable ruff on `Lib/test/test_typing.py` ( #110179 ) ( #110290 )
2023-10-03 15:09:06 +00:00
Victor Stinner
e59ee6c59e
[3.11] gh-108303: Move `ann_module*.py` files to `typinganndata/` folder ( #108354 ) ( #109673 )
...
gh-108303: Move `ann_module*.py` files to `typinganndata/` folder (#108354 )
(cherry picked from commit 3f61cf646d
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-09-21 18:18:39 +00:00
Alex Waygood
e590338893
[3.11] gh-105834: Backport new tests for `typing.Protocol` ( #105835 ) ( #105860 )
2023-06-16 16:39:12 +00:00
Alex Waygood
18e9fd80d9
[3.11] gh-103171: Revert undocumented behaviour change for runtime-checkable protocols decorated with `@final` ( #105445 )
2023-06-07 21:18:21 +00:00
Miss Islington (bot)
ca5524745d
[3.11] Remove raw asserts in test_typing.py (GH-104951) ( #104979 )
...
Remove raw asserts in test_typing.py (GH-104951)
(cherry picked from commit 2cb445635e
)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-26 14:34:37 +00:00
Miss Islington (bot)
5e911673e4
[3.11] Improve test coverage for is_typeddict (GH-104884) ( #104888 )
...
In particular, it's important to test that is_typeddict(TypedDict)
returns False.
(cherry picked from commit 1497607a8e
)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-24 19:23:35 +00:00
Jelle Zijlstra
f106aef24a
[3.11] typing: Add more tests for TypeVar (GH-104571) ( #104577 )
...
During the PEP 695 implementation at one point I made
TypeVar.__name__ return garbage, and all of test_typing passed.
So I decided to add a few more tests.
(cherry picked from commit 26931944dd
)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-17 13:40:34 +00:00
Miss Islington (bot)
1be8bed236
[3.11] gh-104036: Fix direct invocation of test_typing (GH-104037) ( #104039 )
...
gh-104036: Fix direct invocation of test_typing (GH-104037)
Previously, `python -m test test_typing` worked, but `python Lib/test/test_typing.py` did not.
(cherry picked from commit 4181d078fc
)
Co-authored-by: Kirill Podoprigora <80244920+Eclips4@users.noreply.github.com>
2023-05-01 14:17:12 +00:00
Miss Islington (bot)
e0e1bee833
[3.11] gh-103746: Test `types.UnionType` and `Literal` types together (GH-103747) ( #103772 )
...
gh-103746: Test `types.UnionType` and `Literal` types together (GH-103747)
(cherry picked from commit 3d29edaf0a
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-04-24 17:22:36 +00:00
Miss Islington (bot)
4e9635e2b1
[3.11] gh-103592: Add tests of `Literal` with `Enum` and `Union` of `Literal`s (GH-103706) ( #103720 )
...
gh-103592: Add tests of `Literal` with `Enum` and `Union` of `Literal`s (GH-103706)
(cherry picked from commit 5041c2ba6e
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-04-23 12:15:24 -06:00
Miss Islington (bot)
4e284ffa2e
gh-103395: Improve `typing._GenericAlias.__dir__` coverage (GH-103396)
...
(cherry picked from commit a28e2ce3fb
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-04-10 04:37:40 -07:00
Miss Islington (bot)
1b1f0164cb
gh-74690: Add more tests for runtime-checkable protocols (GH-103347)
...
(cherry picked from commit 800382a2b0
)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-04-07 10:47:49 -07:00
Miss Islington (bot)
766038d995
gh-103054: typing: Improve `Callable` type substitution tests (GH-103055)
...
(cherry picked from commit 60bdc16b45
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Eclips4 <80244920+Eclips4@users.noreply.github.com>
2023-03-28 20:28:34 -07:00
Miss Islington (bot)
1645a40b5e
gh-88965: typing: fix type substitution of a list of types after initial `ParamSpec` substitution (GH-102808)
...
Previously, this used to fail:
```py
from typing import *
T = TypeVar("T")
P = ParamSpec("P")
class X(Generic[P]):
f: Callable[P, int]
Y = X[[int, T]]
Z = Y[str]
```
(cherry picked from commit adb0621652
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-03-23 09:54:07 -07:00
Nikita Sobolev
045c8a1779
[3.11] gh-102721: Improve coverage of `_collections_abc._CallableGenericAlias` (GH-102788)
...
This is a backport of https://github.com/python/cpython/pull/102722 without the `typing.py` changes.
Automerge-Triggered-By: GH:AlexWaygood
2023-03-17 12:48:06 -07:00
Miss Islington (bot)
e467cb3a69
gh-102433: Add tests for how classes with properties interact with `isinstance()` checks on `typing.runtime_checkable` protocols (GH-102449)
...
(cherry picked from commit 5ffdaf748d
)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Carl Meyer <carl@oddbird.net>
2023-03-10 17:46:04 -08:00
Miss Islington (bot)
a7ec32e7d4
gh-102444: Fix minor bugs in `test_typing` highlighted by pyflakes (GH-102445)
...
(cherry picked from commit 96e1022929
)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-03-05 14:00:56 -08:00
Miss Islington (bot)
c957128b48
Fix unused classes in a typing test (GH-102437)
...
As part of investigation issue https://github.com/python/cpython/issues/102433 , I discovered what I believe to be an error where two classes `CI` and `DI` are not being used. The assertions beneath them act on `C` and `D`, duplicating existing assertions in this test.
(cherry picked from commit 7894bbe94b
)
Co-authored-by: JosephSBoyle <48555120+JosephSBoyle@users.noreply.github.com>
Automerge-Triggered-By: GH:AlexWaygood
2023-03-05 07:31:42 -08:00
Miss Islington (bot)
9e7acafa14
gh-101562: typing: add tests for inheritance with NotRequired & Required in parent fields (GH-101563)
...
(cherry picked from commit b96b344f25
)
Co-authored-by: Eclips4 <80244920+Eclips4@users.noreply.github.com>
2023-02-06 11:53:53 -08:00
Miss Islington (bot)
29ff9daf82
gh-101015: Fix `typing.get_type_hints` with unpacked `*tuple` (PEP 646) (GH-101031)
...
(cherry picked from commit 807d6b576f
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-01-23 00:20:15 -08:00
Miss Islington (bot)
74920aa27d
gh-99344, gh-99379, gh-99382: Fix issues in substitution of ParamSpec and TypeVarTuple (GH-99412)
...
* Fix substitution of TypeVarTuple and ParamSpec together in user generics.
* Fix substitution of ParamSpec followed by TypeVarTuple in generic aliases.
* Check the number of arguments in substitution in user generics containing a
TypeVarTuple and one or more TypeVar.
(cherry picked from commit 8f2fb7dfe7
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-11-29 06:46:53 -08:00
Miss Islington (bot)
d025046ef5
`test_typing`: use all pickle protocols (GH-99154)
...
(cherry picked from commit a0bc75e2fd
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-11-06 04:15:45 -08:00
Miss Islington (bot)
20c258c692
gh-98852: Fix subscription of type aliases (GH-98920)
...
Fix subscription of type aliases containing bare generic types or types
like TypeVar: for example tuple[A, T][int] and tuple[TypeVar, T][int],
where A is a generic type, and T is a type variable.
(cherry picked from commit 0e15c31c7e
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-11-01 01:01:28 -07:00
Miss Islington (bot)
ce2b56e280
gh-98713: Use `@cpython_only` for a test that fails on PyPy (GH-98714)
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
(cherry picked from commit 9495360c72
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-26 06:41:42 -07:00
Jelle Zijlstra
83c8df29dd
[3.11] GH-87390: Add remaining tests for PEP 646 (GH-98267) ( #98667 )
...
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>.
Co-authored-by: Matthew Rahtz <matthew.rahtz@gmail.com>
(cherry picked from commit cb95cc24ef
)
2022-10-25 18:46:57 -07:00
Miss Islington (bot)
abc1a8c61c
Use more precise exception types in `assertRaises` in typing tests (GH-98650)
...
(cherry picked from commit 45c89358b7
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-25 07:19:37 -07:00
Miss Islington (bot)
5f5fa4ca4b
typing tests: `_overload_dummy` raises `NotImplementedError`, not `RuntimeError` (GH-98351)
...
(cherry picked from commit 1ca6647f22
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-19 18:23:40 -07:00
Shantanu
c9eacc8d02
[3.11] gh-95987: Fix `repr` of `Any` type subclasses (GH-96412) ( #96451 )
...
(cherry picked from commit 4217393
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-05 15:02:06 -07:00
Miss Islington (bot)
f418842a5c
[3.11] gh-96357: Improve `typing.get_overloads` coverage (GH-96358) ( #96371 )
...
gh-96357: Improve `typing.get_overloads` coverage (GH-96358)
(cherry picked from commit 675e3470cc
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-09-28 18:06:21 -07:00
Miss Islington (bot)
f391b3c6ab
gh-96478: Fix new test when run in refleak mode (GH-96615)
...
./python.exe -m test -R : test.test_typing would fail, apparently
because the dictionary used in the @patch decorator was modified.
(cherry picked from commit f0d9136c69
)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-09-27 07:50:36 -07:00
Miss Islington (bot)
2a5e333736
gh-96478: Test `@overload` on C functions (GH-96479)
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
(cherry picked from commit f177f6f29b
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-09-20 18:36:23 -07:00
Miss Islington (bot)
16d8948c31
gh-96385: Correctly raise error on `[*T, *V]` substitution (GH-96386) ( #96407 )
...
(cherry picked from commit 75177358a6
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-08-30 11:58:54 +01:00
Miss Islington (bot)
b4e232c4b5
gh-94607: Fix subclassing generics (GH-94610)
...
Co-authored-by: Serhiy Storchaka <3659035+serhiy-storchaka@users.noreply.github.com>
(cherry picked from commit 6442a9dd21
)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2022-07-08 22:20:43 -07:00
Miss Islington (bot)
125146771c
gh-94245: Test pickling and copying of typing.Tuple[()] (GH-94259)
...
(cherry picked from commit 75cb3abc3b
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-06-25 09:10:08 -07:00
Miss Islington (bot)
8dc5df4e21
[3.11] gh-91162: Support splitting of unpacked arbitrary-length tuple over TypeVar and TypeVarTuple parameters (alt) (GH-93412) (GH-93746)
...
For example:
A[T, *Ts][*tuple[int, ...]] -> A[int, *tuple[int, ...]]
A[*Ts, T][*tuple[int, ...]] -> A[*tuple[int, ...], int]
(cherry picked from commit 3473817106
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-06-14 21:15:56 +03:00
Miss Islington (bot)
3265ff9ccc
gh-93345: Fix a crash in substitution of nested TypeVar after TypeVarTuple (GH-93346)
...
For example: tuple[*Ts, list[T]][int, str, bool]
(cherry picked from commit f545fc955a
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-05-31 23:43:38 -07:00
Miss Islington (bot)
00f8fe9564
[3.11] gh-91162: Fix substitution of unpacked tuples in generic aliases (GH-92335) ( #92484 )
...
* gh-91162: Fix substitution of unpacked tuples in generic aliases (GH-92335)
(cherry picked from commit 9d25db9db1
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Regenerate ABI file
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2022-06-01 03:13:27 +01:00
Miss Islington (bot)
7540a432ce
gh-92261: Disallow iteration of Union (and other special forms) (GH-92262) (GH-92582)
...
(cherry picked from commit 4739997e14
)
Co-authored-by: Matthew Rahtz <matthew.rahtz@gmail.com>
2022-05-10 08:39:31 +03:00
Serhiy Storchaka
9d20e1af40
gh-92107: Add tests that subscription works on arbitrary named tuple types (GH-92304)
2022-05-04 17:06:50 +03:00
Samodya Abey
f6f36cc269
bpo-44863: Allow generic typing.TypedDict ( #27663 )
...
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-05-03 07:21:42 -06:00