File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 163163 "builtins.tuple" ,
164164 "typing.Iterable" ,
165165 "typing.Container" ,
166+ "typing.Collection" ,
166167 "typing.Sequence" ,
167168 "typing.Reversible" ,
168169)
Original file line number Diff line number Diff line change @@ -4601,6 +4601,23 @@ inputs: Sequence[Component] = [{
46014601[builtins fixtures/dict.pyi]
46024602[typing fixtures/typing-typeddict.pyi]
46034603
4604+ [case testTypedDictTupleExpressionWithCollectionContext]
4605+ import collections.abc
4606+ from typing import Collection, TypedDict
4607+
4608+ class Item(TypedDict):
4609+ x: int
4610+
4611+ def take(items: Collection[Item]) -> None: ...
4612+ def take_abc(items: collections.abc.Collection[Item]) -> None: ...
4613+
4614+ take(({"x": 1}, {"x": 2}))
4615+ take_abc(({"x": 1}, {"x": 2}))
4616+ items: Collection[Item] = ({"x": 1}, {"x": 2})
4617+ abc_items: collections.abc.Collection[Item] = ({"x": 1}, {"x": 2})
4618+ [builtins fixtures/dict.pyi]
4619+ [typing fixtures/typing-typeddict.pyi]
4620+
46044621[case testTypedDictAssignableToWiderContext]
46054622from typing import TypedDict, Union
46064623
Original file line number Diff line number Diff line change @@ -47,6 +47,8 @@ class Iterable(Protocol[T_co]):
4747class Iterator (Iterable [T_co ], Protocol ):
4848 def __next__ (self ) -> T_co : pass
4949
50+ class Collection (Iterable [T_co ]): pass
51+
5052class Sequence (Iterable [T_co ]):
5153 def __getitem__ (self , n : Any ) -> T_co : pass # type: ignore[explicit-any]
5254
You can’t perform that action at this time.
0 commit comments